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.
Questions tagged [appsettings]
1058 questions
14
votes
2 answers
Unable to set my connectionstring in NLog
The NLog.config file does not set the connection string.

arame3333
- 9,887
- 26
- 122
- 205
14
votes
2 answers
Inject App Settings using Windsor
How can I inject the value of an appSettings entry (from app.config or web.config) into a service using the Windsor container? If I wanted to inject the value of a Windsor property into a service, I would do something like this:
…

Damian Powell
- 8,655
- 7
- 48
- 58
13
votes
2 answers
NLog config file to get configuration setting values from a web.config
Is there a method to get a value from the section of a web.config within NLog layout variables?
I already store SMTP details within my web.config and don't want to duplicate the settings just to use within my…

Dave Hogan
- 3,201
- 6
- 29
- 54
13
votes
1 answer
Don't delete AppSettings not declared in a template
When deploying an Azure Function App and AppSettings via an ARM Template, is it possible to tell Azure not to delete AppSettings that are not declared in the template?
For example, take the following AppSettings config from the template and imagine…

David Gard
- 11,225
- 36
- 115
- 227
13
votes
7 answers
Best practices for storing UI settings?
we're currently planning a larger WPF LoB application and i wonder what others think being the best practice for storing lots of UI settings e.g.
Expander States
Menu orders
Sizing Properties
etc...
i don't like the idea of having dozens of stored…

Joachim Kerschbaumer
- 9,695
- 7
- 49
- 84
12
votes
2 answers
Performance issues with repeated calls to ConfigurationManager.AppSettings to get appsetting values?
I'm working on a code base that has a lot of identical ConfigurationManager.AppSetting calls scattered throughout.
Does this sound like a possible performance issue?
Or because the data being very small is trivial and not 'expensive'? Constantly…

Sara Gamage
- 372
- 1
- 3
- 16
12
votes
3 answers
Override App.config value with an environment variable
I have a C# console program that prints an App.config value. Can I override this value from an environment variable?
Example App.config:
Example Code:
Console.WriteLine($"Key:…

sashoalm
- 75,001
- 122
- 434
- 781
12
votes
3 answers
how to change .NET user settings location
By default settings are stored at: C:\Documents and Settings\\Local Settings\Application Data\
How can I change this path to application directory. I also don't want to have different files for different users. How make the settings…

mack369
- 441
- 2
- 6
- 10
12
votes
3 answers
Storing values in the web.config - appSettings or configSection - which is more efficient?
I'm writing a page that can use a couple of different themes, and I'm going to store some information about each theme in the web.config.
Is it more efficient to create a new sectionGroup and store everything together, or just put everything in…

coder1
- 3,447
- 5
- 30
- 46
12
votes
2 answers
Save File to MyDocuments + App Folder
I am trying to save my .NET application settings file to the user's %MyDocument%\MyApplication folder, but I don't know how to check for an existing folder\file, and create or append the folder\file on save. I don't want to open a saveFileDialog…

Jeagr
- 1,038
- 6
- 16
- 30
11
votes
1 answer
Can I move configuration from appsettings.json to database in an ASP.NET Core MVC application?
I have this application that uses the appsettings.json to store some configurations like API addresses, tokens, paths to save files, etc.
We don't have DevOps, so for each change we do in the appsettings, we need to ask infrastructure team to deploy…

Elek Guidolin
- 487
- 1
- 8
- 21
11
votes
1 answer
How to add values through user secrets to an array of objects in C#
So I'm having issues trying to get Visual Studio to add user secrets to a property that is an array. I have a feeling this sort of thing can't be done but I really need to have a way of iterating through the each of them for what I'm doing and I'm…

Chris Marshall
- 740
- 1
- 9
- 25
11
votes
3 answers
Change an Azure App Setting using the portal without a restart
I sometimes to this:
In the Azure portal, I go to "App Services", then I click on my web app, and then I go to "Application Settings".
Here I change one value from the "App Settings" list:
Eg. I change "128" to "129"
Finally I click on "Save".
This…

sports
- 7,851
- 14
- 72
- 129
11
votes
4 answers
How can I change a setting in appsettings.json after auto-deploy?
I have an ASP.NET Core application going on an have setup Github auto-deploy on it. But since it's an open repo I obviously don't want to upload my correct configuration file.
What I'd like to do is to replace some strings in the appsettings.json…

Ms01
- 4,420
- 9
- 48
- 80
11
votes
3 answers
Get initial JSON representation of ConfigurationSection
Let's assume we have this section in appsettings.json
{
"crypto":{
"A": "some value",
"B": "foo foo",
"C": "last part"
},
...
}
Where "crypto" is json serialization of some cryptographic key.
Later in the code, I need to…

Ph0en1x
- 9,943
- 8
- 48
- 97