Questions tagged [appsettings]

appsettings.json (Application Settings) is a settings file. When configured, it can be used by .NET as a configuration source for settings you need at runtime & is automatically used by IIS to load all relevant web server settings. You can have multiple appsettings.json files for various environments in the format of appsettings.Environment.json e.g. appsettings.Production.json. Also used commonly to store logging settings like level & verbosity.

Filter by
Sorted by
Tagged with
0 votes
1 answer
28 views

How to access values in appsettings.json similiarly to accessing values in web.confi

Inn the way the web.config file can be accessed through using System.Configuration.ConfigurationManager in asp.net, is there a way to access values in the appsettings.json file like so, without the ...
Yan Soo's user avatar
0 votes
0 answers
24 views

Angular client retrieve data(URL) from appsetting.json

I have an appsettings.json what is out of angular client, its in AppWeb.appsettings.json ... and angular is AppWeb.ClientApp.src ... how can i use link from appsettings.json in my angular app "...
chivas's user avatar
  • 21
0 votes
0 answers
12 views

Visual Studio Code - settings.json - test discovery error

I have a C# project with Specflow in Visual Studio, and I want learn to run the tests in Visual Studio Code. Installed extensions and can run the feature file tests, but I want to use an appsetting.qa....
Guy's user avatar
  • 718
0 votes
1 answer
44 views

How to refrain from storing credentials in the code in C# ASP.NET core 6.0?

I have to ensure that authentication has been set up to restrict access to the API. And to do that I believe I have to add security or authentication to a web app under the appsettings.json by making ...
Thabang Benny Kwinana's user avatar
1 vote
2 answers
72 views

Read Appsettings in test project

I have a test method that while executing calls a method in the class which has the following line _configuration.GetValue<string>("Root:Child"); The class has IConfiguration injected ...
TrialByFire's user avatar
0 votes
1 answer
62 views

How to specify the path in github actions for creating an artifact?

I have created a github actions job to download the appsettings.json file but the github action is unable to find the path to my appsettings.json file. I have a .net application and my file structure ...
dev_in_training's user avatar
0 votes
0 answers
78 views

How to access appsettings from Blazor Hybrid in Winforms

I'm trying to setup DI in a Winforms Blazor app. Winforms is used simply a placeholder for the all the Blazor functionality. I understand the Blazor DI is setup within the form constructor (as per Dan ...
Craig's user avatar
  • 535
1 vote
1 answer
63 views

.NET 7 removes empty string from the array loaded from appsettings in unit test

In the appsettings is an array with an empty string in it. I run the API and get the value by calling config.GetSection("AppSettings").GetSection("Mapping").Get<string[][]>() ...
majo's user avatar
  • 45
1 vote
1 answer
55 views

ASP.NET get whole object from appsettings

If I have the following setup, is there a way to request the settings from within Program.cs. appsettings.json: { "Settings": { "UseMemory": false, "Cors": { ...
nick zoum's user avatar
  • 7,247
0 votes
1 answer
58 views

C# access configuration settings during ConfigureServices

Is there a working method accessing configuration values during ConfigureServices() in C# netCore? I have a dapr settings added as 'options pattern', but need the values in the same section ...
Zoltan Hernyak's user avatar
1 vote
1 answer
79 views

From where is my Azure App Service fetching app settings?

I have a .NET 6 web API that I deploy to Azure App Service using GitHub actions. My web API contains 3 app settings files: appsettings.json appsettings.development.json appsettings.production.json ...
uodami's user avatar
  • 103
0 votes
3 answers
207 views

How to use different appsettings.json file for different deployment?

I have .NET Core 7 WEB API project. In there, I have 3 settings files. More pecisely: appsettings.json appsettings.QA.json appsettings.Production.json appsettings.Development.json. The behavior I ...
Vladimir99's user avatar
0 votes
1 answer
33 views

secure access to keyvault from desktop app

I created a consol app to access Azure key vault. To do that I put the appId and appSecret in appsettings.json file. Is this secure. I mean putting the secret of the app here to be able to use it and ...
SM1023's user avatar
  • 3
0 votes
1 answer
189 views

Setup production certificate for Windows Service hosted ASP.NET Core web application with thumbprint

I have a Windows Service hosted web app created with this tutorial (Web Application as Windows Service section): https://csharp.christiannagel.com/2022/03/22/windowsservice-2/ So far everything works. ...
SZL's user avatar
  • 805
0 votes
0 answers
117 views

How to get Quartz to read appsettings.json in .Net6 app

I am trying to configure Quartz scheduling (v3.7) using appsettings.json, but it appears not to be reading the configuration file. My appsettings.json contains this: { : "Quartz": { &...
Black Light's user avatar
  • 2,368
1 vote
1 answer
79 views

When using ConfigurationBuilder and appsettings.json, is it possible to set custom property binding?

Pretty standard procedure for manual configuration wire up var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") ...
T.S.'s user avatar
  • 18.4k
1 vote
1 answer
59 views

Place appsettings.json for NUnit on agent to use in Azure DevOps pipeline

I am using an Azure DevOps pipeline to execute unit tests and deploy my Blazor Server application to an agent. I use the NUnit test framework and PostgreSQL as database. For the unit tests, I use a ...
a.r.'s user avatar
  • 11
0 votes
1 answer
56 views

Use environment based appSettings in .NET on same windows server

I have two environments UAT and Production which are on the same windows server but different folders. We have appSettings.json and appsettings.development.json. I would like UAT to use appsettings....
Learn AspNet's user avatar
  • 1,282
3 votes
0 answers
48 views

Problems configuring latest Serilog from appSettings.json

I am using Serilog and getting the configuration from the appsettings.json file. I need to update the following code, which worked with an earlier version of the Serilog library but does not work with ...
user1154422's user avatar
0 votes
0 answers
38 views

WebApplicationFactory gets connection string from service appsettings.json not test project appsettings.json

My api project has an appsettings.json with a connection string for "Settings" database My WebApplicationFactory in the test project has an appsettings.json with a connection string for &...
HelloWorld's user avatar
  • 4,711
1 vote
0 answers
104 views

ASPNET Core: events raised by settings changes using IOptionsMonitor

I have created a basic ASPNET Core Web Application (.NET6.0) with MVC pattern. The goal is to monitor the changes in appsettings.json using events raised by IOptionsMonitor. My appsettings.json is the ...
Alessandro Ciurlo's user avatar
0 votes
1 answer
39 views

Does ASP.NET Core allow you to read in the ENTIRE appsettings.json in a single call into a single class?

I've been manually reading all the sections of my Configuration (e.g. appsettings.json, env vars, secrets, etc) by reading in each "section", one by one. Works great. But is it possible to ...
Pure.Krome's user avatar
  • 85.2k
0 votes
0 answers
52 views

How to make local appsettings development json values used by localhost?

I have the following config in my .net Core 6.0 app: launchSettings.json { "$schema": "https://json.schemastore.org/launchsettings.json", "iisSettings": { "...
nickornotto's user avatar
  • 1,996
1 vote
2 answers
259 views

How to load values for different appsettings.json files from their respective properties files in .NET Core

I am working on a .NET Core project where I have an appsettings.json file for each environment (Dev, Prod). I want to load values for these appsettings files from the respective properties files (...
ravikiran reddy's user avatar
0 votes
1 answer
80 views

How to update/reload LogLevels, configured by appsettings.json at runtime?

I am working on a .NET6 Kestrel application using appsettings.json for configuration and default console logging. What I try to do is, that I want to change log-levels at runtime. However, so far the ...
Ciprian's user avatar
  • 141
1 vote
1 answer
136 views

Username in Serilog file name in ASP.NET Core

I have an ASP.NET Core Web API. I need to add the username to the Serilog file name. My appsettings.json file looks like this: "Serilog": { "MinimumLevel": { "...
Dnyati's user avatar
  • 165
0 votes
1 answer
18 views

The best way to test appsettings.release.json locally in .net

I have appsettings.release.json how do I test it locally while debugging?
SmallWorld's user avatar
0 votes
1 answer
161 views

Build and Deploy .NET Core pipeline through github actions

I have a pipeline that runs fine and it gets deployed to Windows server. The issue is I want the development environment to use appsettings.development.json and production to use appsettings.json. How ...
Learn AspNet's user avatar
  • 1,282
0 votes
0 answers
85 views

Save configuration changes into appsettings.json

I have old .NET 2.0 desktop application that uses standard Settings.settings in a following way: [Serializable] public class AlgebraStatsParams { public List<GeneratorStats> ...
amuliar's user avatar
  • 1,358
0 votes
0 answers
15 views

appsettings configurations for enabling a group and subgroups

Let's suppose I have an dotnet web api with controllers containing endpoints that we can consider each controller a subgroup and some of this subgroups belong to a bigger group. Now I want to itemize ...
Nmaster88's user avatar
  • 1,445
0 votes
0 answers
90 views

Transform appsettings.json in MS Web Deploy Package archive before publishing to IIS (ASP.NET Core)

We're currently migrating a large ASP.NET WebAPI application to ASP.NET Core MVC, which has involved migrating our app setting defaults from a Web.config file into appsettings.json. We'll host on ...
Andrew's user avatar
  • 511
3 votes
2 answers
411 views

Use different appsettings.json on different machines having same environment

I have a .NET 6 console app that runs on multiple servers to monitor apps on them. The multiple servers already have their environment variable setup for other apps that use these values. For example: ...
Ash K's user avatar
  • 2,471
0 votes
1 answer
56 views

.NET6, Getting away from appsettings.json for App Service (Web App) by leveraging the Azure Functions local.settings.json strategy

I'd like to store all of my Application setting within Azure Configuration, but cannot seem to escape the need to maintain an AppSettings.json file. AppSettings.json files are deployed to my Azure ...
Bill Roberts's user avatar
  • 1,127
-1 votes
1 answer
34 views

How to access ConfigurationManager during host program startup?

I'm setting up a Worker Service, and I need to pass a connection string to UseSqlServerStorage(). IHost host = Host.CreateDefaultBuilder(args) .ConfigureServices(services => { ...
Jonathan Wood's user avatar
0 votes
0 answers
27 views

Does anyone know how to correctly put brackets in settings.jsn?

I have a problem with visual studio code and json settings. Was trying to adjust settings but it appears as an error. I assume it's because of brackets but tried in various ways and still didnt ...
Weronika Wuwu's user avatar
1 vote
0 answers
67 views

Polymorphic deserialization not working when deserializing appsettings.json

I have a base class Target and two derived classes TargetA and TargetB. From appsettings.json , I want to deserialize to the type of derived object (which can be either TargetA or TargetB at runtime)....
Nin's user avatar
  • 21
1 vote
0 answers
21 views

How can polymorphic deserialisation be used out of the box for appsettings in .net 7?

Trying to deserialise appsettings.json using polymorphism support in .NET7. See this appsettings.json, for example: { "Logging...., "Actions": [ { "$...
Nikolai's user avatar
  • 208
0 votes
1 answer
78 views

How to convert appsettings.json section to dynamic and then to class object in C#

I have an appsettings: "testData": [ { "target": "MarketMirrorClient.GetContests", "mockData": [ { "request": { ...
Maxx's user avatar
  • 11
1 vote
1 answer
293 views

why my unit test project is not using proper appsettings.Test.json when appsettings.json contains placeholders?

I have a dotnet core 6 solution. In my API project I have set the appsettings.json to have some placeholders, like that: "Host": #{Logging__StdLog__QueueSettings__Host}#, "Port&...
HalfBloodPrince's user avatar
0 votes
0 answers
165 views

How to solve this problem in Entity Framework migration?

An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Unable to build IHost System.ArgumentException: Format of the ...
massume dehghani's user avatar
0 votes
0 answers
25 views

Nuget Package Manager cannot Find ConnectionString

TLDR: ConnectionStrings for options.useSQLServer.GetConnectionString is returning null. Changing names does not work. Hardcoding the connection string did work, so it seems to be a config issue. I've ...
thinker's user avatar
  • 167
0 votes
2 answers
153 views

Reading appsettings.json file settings is always null. How to do this in .NET 7 (the best way)?

I am switching a project from .NET Core 3.1 to .NET 7, but, but I can't seem to get this to work. I thought the configuration was already built into the framework (using Blazor) and configuration data ...
MC9000's user avatar
  • 2,114
0 votes
0 answers
13 views

asp.Net Core 3.1 MVC Set launchUrl to Web Server url not using IP or localhost

I'm trying to understand how to set the launchUrl in appsettings to test a new app via a test server. I've done this previously when provided an IP and Port but this time I've been provided a physical ...
SND69's user avatar
  • 27
0 votes
0 answers
58 views

Dotnet new ASP.NET Core Web API reads current connectionString from appsettings.json, but sends web requests using a previous connectionString

Using the first-ever template that I created in dotnet new, I generated a solution in Visual Studio 2022 with an ASP.NET Core Web API project; this project contains an appsettings.json file and a ...
jmagen's user avatar
  • 41
-1 votes
2 answers
91 views

Load json section to Dictionary C# and preserver insertion order

Json file entry looks like this: settings.json { "MyJson": { "Machine": "machine", "Date": "date", "Time": "time", ...
Jaspreet Kaur Banwait's user avatar
1 vote
1 answer
70 views

Locally published C# API not getting values from appsettings.json

I wanted to run metrics against my .NET 7 API. To do so, I read, to get the most accurate metrics, I should publish it. But, when I do, my application is not getting the values from my appsettings....
ScubaSteve's user avatar
  • 7,864
0 votes
1 answer
77 views

Is there a way to reference an appsettings value within the Serilog section in appsettings?

Using Serilog.Settings.Configuration (and presumably Serilog.Expressions) is it possible to reference another appsettings value? I'm trying to dynamically set endpointUrl below without duplicating the ...
Ben's user avatar
  • 1
0 votes
1 answer
101 views

Replacement for adding certificate in .net6 app

I am struggling with replacing my existing add certificate code when upgrading from .net 4.8 to .net 6 Here is the set up post upgrade: Program.cs private static async Task Main(string[] args) { ...
Lucky's user avatar
  • 137
1 vote
0 answers
187 views

How to limit 5 instances of log file creation using Serilog if fileSizeLimitBytes is full

I am using Serilog to create log files in C#/.NET. Now there is a task to create a new instance of the log file if fileSizeLimitBites is full and the request is to limit it to 5 log files, if the ...
DraganMilovac1993's user avatar
0 votes
1 answer
83 views

How to add additional IConfigurationProvider to console app?

I'm working on a console application where I'm trying to read the settings from "appsettings.Development.json". Host.CreateDefaultBuilder(args) .ConfigureServices((hostContext, services) ...
Da Ta's user avatar
  • 87

1
2 3 4 5
22