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
20
votes
7 answers
How can I build an IOptionsMonitor for testing?
For the normal IOptions interface, you can manually build an instance e.g. this SO question.
Is there any equivalent way to make an IOptionsMonitor instance without using DI?

alksdjg
- 1,019
- 2
- 10
- 26
20
votes
3 answers
JetBrains Rider - configure appsettings overrides
I am trying JetBrains Rider for my existing .NET Core project. In the project I have several appsettings.json overrides:
appsettings.Development.json - for development
appsettings.Test.json - for testing
appsettings.Staging.json - for staging…

lss
- 1,235
- 3
- 15
- 24
19
votes
2 answers
Reading dll.config (not app.config!) from a plugin module
I am writing a C# .NET 2.0 .dll that is a plug in to a Larger application. The visual studio project for my module has a app.config file which is copied to a MyProj.dll.config along side of MyProj.dll.
The plan is that MyProj.dll.config will be…

Rodney Schuler
- 2,158
- 4
- 23
- 34
17
votes
3 answers
Error parsing AppSettings value with a query string
In my AppSettings in web.config, I have something like this:
However, it seems that when an ampersand (&) is…

Brandon
- 13,956
- 16
- 72
- 114
17
votes
1 answer
POCO object array inside AppSettings.json in ASP.NET Core
This seems like it should be really simple, I have been searching SO and a lot of other places for an answer to this, everything I have found and tried does not work.
I have an appsettings.json file that looks like this
"Email": {
"Port":…

Chase Thomas
- 491
- 1
- 5
- 9
17
votes
1 answer
How to configure nested objects from appsettings.json in .NET Core?
VS2015 Pro, .NET Core, Web Application.
I'm trying to figure out how to get objects out of appsettings, that have nested objects. I can do it with single level objects by creating a POCO with simple types that match the config names. But with more…

Steve Eggering
- 759
- 2
- 9
- 23
16
votes
4 answers
Can I set listen URLs in appsettings.json in ASP.net Core 2.0 Preview?
I'm creating an ASP.net Core 2.0 app to run on the .net Core 2.0 runtime, both currently in their Preview versions. However, I cannot figure out how to have Kestrel use something other than the default http://localhost:5000 listen URL.
Most…

Henry
- 272
- 1
- 2
- 7
16
votes
2 answers
Using connection string from appsettings.json to startup.cs
Currently in Startup, I have my sql server string looking like this:
public void ConfigureServices(IServiceCollection services)
{
var connection = @"Server=servername;Database=database;Trusted_Connection=True;MultipleActiveResultSets=true";
…

enavuio
- 1,428
- 2
- 19
- 31
16
votes
3 answers
How can I read/write app.config settings at runtime without using user settings?
I'm looking for a way to store application or machine level settings that can be written to at runtime using Application Settings. User settings allow read/write but application settings do not. I have been using user settings for saving settings…

Tim Santeford
- 27,385
- 16
- 74
- 101
16
votes
4 answers
Objective-C - Detect when user change the app's notifications settings
I need to always know which options the user choose on the push notification settings.
(The options are - alert, sound and badges)
So when my app launch I call:
UIRemoteNotificationType types = [[UIApplication sharedApplication]…

Eyal
- 10,777
- 18
- 78
- 130
15
votes
4 answers
Encrypting appSettings in web.config
I am developing a web app which requires a username and password to be stored in the web.Config, it also refers to some URLs which will be requested by the web app itself and never the client.
I know the .Net framework will not allow a web.config…

Mauro
- 4,531
- 3
- 30
- 56
15
votes
2 answers
How do you access appsetting.json parameters in an AuthorizeAttribute class in .Net Core
In my ASP.NET Core MVC app, I have a class that inherits from AuthorizeAttribute and implements IAuthorizationFilter.
namespace MyProject.Attributes
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true,…

GarethPN
- 432
- 4
- 11
15
votes
1 answer
Read appsettings.json from a class in .NET Core 2
I need to read a list of properties from appsettings.json file (section: placeto) in a business class, but I haven't been able to access them. I need these properties to be public.
I add the file in the Program class:
This is my…

Jhon Diaz
- 187
- 1
- 1
- 13
14
votes
3 answers
How to update appsettings.json based on publish profile using .NET Core?
I'm currently making the switch from .NET Framework to .NET Core. In the past, all of my application settings were in the Web.config file. When I added a new publish profile, I could right click and select 'Add Config Transform' which would generate…

Matthew
- 777
- 1
- 9
- 23
14
votes
1 answer
Removing inherited ASP.NET Core appsettings
I have the following setup in my Startup:
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", true, true);
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true, true)
appsettings.json:
{
"Logging": {
…

Sigurd Garshol
- 1,376
- 3
- 15
- 36