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
951
votes
28 answers
Reading settings from app.config or web.config in .NET
I'm working on a C# class library that needs to be able to read settings from the web.config or app.config file (depending on whether the DLL is referenced from an ASP.NET web application or a Windows Forms application).
I've found…

Russ Clark
- 13,260
- 16
- 56
- 81
331
votes
24 answers
Getting value from appsettings.json in .net core
Not sure what am I missing here but I am not able to get the values from my appsettings.json in my .net core application. I have my appsettings.json as:
{
"AppSettings": {
"Version": "One"
}
}
Startup:
public class Startup
{
…

aman
- 4,198
- 4
- 24
- 36
225
votes
19 answers
Opening the Settings app from another app
Okay, I know that there are many question about it, but they are all from many time ago.
So. I know that it is possible because the Map app does it.
In the Map app if I turn off the localization for this app, it send me a message, and if I press…

FelipeDev.-
- 3,113
- 3
- 22
- 32
220
votes
14 answers
Automatically set appsettings.json for dev and release environments in asp.net core?
I've defined some values in my appsettings.json for things like database connection strings, webapi locations and the like which are different for development, staging and live environments.
Is there a way to have multiple appsettings.json files…

meds
- 21,699
- 37
- 163
- 314
208
votes
18 answers
AppSettings get value from .config file
I'm not able to access values in configuration file.
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
var clientsFilePath = config.AppSettings.Settings["ClientsFilePath"].Value;
// the second line gets…

Matt
- 8,195
- 31
- 115
- 225
168
votes
9 answers
How to check if an appSettings key exists?
How do I check to see if an Application Setting is available?
i.e. app.config
and in the…

bitcycle
- 7,632
- 16
- 70
- 121
140
votes
10 answers
Read appsettings json values in .NET Core Test Project
My Web application needs to read the Document DB keys from appsettings.json file. I have created a class with the key names and reading the Config section in ConfigureServices() as:
public Startup(IHostingEnvironment env) {
var builder = new…

S.Siva
- 1,901
- 4
- 17
- 22
103
votes
13 answers
Get ConnectionString from appsettings.json instead of being hardcoded in .NET Core 2.0 App
I have the following class in NET Core2.0 App.
// required when local database does not exist or was deleted
public class ToDoContextFactory : IDesignTimeDbContextFactory
{
public AppContext CreateDbContext(string[] args)
{
…

borisdj
- 2,201
- 3
- 24
- 31
98
votes
9 answers
ConfigurationManager.AppSettings - How to modify and save?
It might sound too trival to ask and I do the same thing as suggested in articles, yet it doesn't work as expected. Hope someone can point me to the right direction.
I would like to save the usersettings per AppSettings.
Once the Winform is closed I…

Houman
- 64,245
- 87
- 278
- 460
85
votes
4 answers
Bind to a value defined in the Settings
In WPF, Can I use binding with values defined in Settings? If this is possible, please provide a sample.
Moheb
84
votes
8 answers
how to get value from appsettings.json
public class Bar
{
public static readonly string Foo = ConfigurationManager.AppSettings["Foo"];
}
In the .NET Framework 4.x, I can use the ConfigurationManager.AppSettings ["Foo"] to get Foo in Webconfig,and then I can easily get the value of…

ChiakiYu
- 905
- 1
- 8
- 7
76
votes
8 answers
manual language selection in an iOS-App (iPhone and iPad)
My question:
How can my iPhone-app tell the iOS, that the user did select a language in the apps preferences, that is different from the language set in the general settings?
Other formulation of the same question:
How can i tell the system, that…

Hubert Schölnast
- 8,341
- 9
- 39
- 76
74
votes
3 answers
What is the difference between app.config file and XYZ.settings file?
I am actually in the learning phase of .NET related stuff and I was exploring how to save the application. I ended up writing my own class which saves the settings in an XML file and then I found that .NET itself supports saving application…

Hemant
- 19,486
- 24
- 91
- 127
73
votes
8 answers
Why isn't there an XML-serializable dictionary in .NET?
I need an XML-serializable dictionary. Actually, I now have two quite different programs that need one. I was rather surprised to see that .NET doesn't have one.
Can someone enlighten me, given how dependent various .NET features are on XML…

serialhobbyist
- 4,768
- 5
- 43
- 65
72
votes
15 answers
ASP.NET Core appsettings.json update in code
I am currently working on project using asp.net core v1.1, and in my appsettings.json I have:
"AppSettings": {
"AzureConnectionKey": "***",
"AzureContainerName": "**",
"NumberOfTicks": 621355968000000000,
"NumberOfMiliseconds": 10000,
…

Siemko
- 802
- 1
- 7
- 15