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
66
votes
6 answers
How to get values from appsettings.json in a console application using .NET Core?
i'm creating a console application using .NET Core 3.1 and i would like to have an appsettings json to load all
environment, paths, variables,... at the beginning of the execution, and then get values from other library classes.
I have created a…

JaviL
- 763
- 1
- 5
- 5
64
votes
3 answers
How to read appsettings.json in my _layout.chtml
I cannot seem to figure out how to read values from the appsettings.json in my _Layout.chtml file.
Is it not just available, something like this?
@Configuration["ApplicationInsights:InstrumentationKey"]
I created a new MVC project using razor…

user3693957
- 669
- 1
- 5
- 6
57
votes
2 answers
Multiple AppSettings files, is it possible?
I want to create 3 AppSettings config files:
Database.config
Messages.config
Global.config
And after add in my App.config:
But when…

Vinicius Ottoni
- 4,631
- 9
- 42
- 64
56
votes
9 answers
Find current country from iPhone device
I have to get the current country in the iPhone settings. Can anyone tell me how to get the current country in iPhone application.
I have to use the current country for parsing the RSS feed in which I need to pass the current country.
Please help…

AppAspect
- 4,461
- 2
- 30
- 46
56
votes
4 answers
appSettings vs applicationSettings. appSettings outdated?
I've got some questions about two ways to save settings in the web.config.
Appsettings:
Look in web.config
Usage in…

citronas
- 19,035
- 27
- 96
- 164
52
votes
7 answers
Form submit resulting in "InvalidDataException: Form value count limit 1024 exceeded."
I have created an mvc site and I'm posting a large amount of json form data (Content-Type:application/x-www-form-urlencoded)
back to the mvc controller. When I do this, I receive a 500 response that states: "InvalidDataException: Form value count…

Michiel Bugher
- 1,005
- 1
- 7
- 23
51
votes
26 answers
Value cannot be null. Parameter name: connectionString appsettings.json in starter
I am trying to write my connection string in my appsettings.json file and bring it into my startup file but I keep getting a Value cannot be null.
Parameter name: connectionString. I have been using various examples but can't seem to see this new…

enavuio
- 1,428
- 2
- 19
- 31
47
votes
7 answers
Read values from local.settings.json in VS 2017 Azure Function development
I am writing an Azure function in VS 2017. I need to set up a few custom configuration parameters. I added them in local.settings.json under Values.
{
"IsEncrypted":false,
"Values" : {
"CustomUrl" : "www.google.com",
"Keys": {
…

Venkata Dorisala
- 4,783
- 7
- 49
- 90
43
votes
2 answers
How to hardcode and read a string array in appSettings.json?
I use VSCode and NetCore 1.1.1.
I need to store several datapaths in my appsetting.json to let my console application know where to look for its data.
This is an extract of the appsettings.json file:
{
"ConnectionStrings":
{
…

nico9T
- 2,496
- 2
- 26
- 44
42
votes
1 answer
Adding settings class to a UWP app
I'm developing a Universal Windows Platform app but there is no Settings template in Visual Studio.
How can I implement an easy, strongly typed and observable class that stores my settings in LocalSettings or RoamingSettings?

joseangelmt
- 2,018
- 18
- 32
37
votes
6 answers
Configuration.GetSection in Asp.Net Core 2.0 getting all settings
I am trying to learn the various ways to retrieve configuration info so I can determine the best path for setting up and using configuration for an upcoming project.
I can access the various single settings using
var sm = new SmsSettings
{
…

dinotom
- 4,990
- 16
- 71
- 139
36
votes
6 answers
Restoring Window Size/Position With Multiple Monitors
Many posts around about restoring a WinForm position and…

Michael Sorens
- 35,361
- 26
- 116
- 172
35
votes
2 answers
Azure Application Settings not overriding my appsettings.json file values
I have tried adding DefaultConnection from my appsettings.json file to Azure's Application Settings but Azure will not override the connection string.
Any article or blog I can find states that all I should need to do is add the connection string…

psycho
- 1,539
- 4
- 20
- 36
34
votes
2 answers
How to Refresh a token using IHttpClientFactory
I am using IHttpClientFactory for sending requests and receiving HTTP responses from two external APIs using Net Core 2.2.
I am looking for a good strategy to get a new access token using a refresh token that has been stored in the appsettings.json.…

D.B
- 4,009
- 14
- 46
- 83
34
votes
3 answers
How to check if Configuration Section exists in .NET Core?
How can you check if a configuration section exists in the appsettings.json in .NET Core?
Even if a section doesn't exist, the following code will always return an instantiated instance.
e.g.
var section =…

PatrickNolan
- 1,671
- 2
- 20
- 40