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.

1058 questions
10
votes
3 answers

Worker Service looking for appsettings.json in System32 folder instead of local folder

I have a .Net core worker service, which I am running as a windows service. The service is using appsettings.json file for the config information. After installing the service using SC CREATE command, the service was failing. In the event viewer I…
Ajith
  • 1,447
  • 2
  • 17
  • 31
10
votes
1 answer

Is there a way to use F# record types to extract the appsettings.json configuration?

Long story short I can extract the appsettings.json to the Configuration type when I use C#-like classes: type Connection() = member val Host = Unchecked.defaultof with get,set member val Port = Unchecked.defaultof with get,set …
Natalie Perret
  • 8,013
  • 12
  • 66
  • 129
10
votes
4 answers

Unable to parse string to integer value

I really don't have the idea on why I am getting 0 value on this: But this code works well: int val = Convert.ToInt32("1546"); Here is the appsetting: Any idea? Edit1 I want to get the…
fiberOptics
  • 6,955
  • 25
  • 70
  • 105
10
votes
3 answers

ConfigurationManager in WPF

I have a config file in a wpf project to store the connectionstring. But when I try to get AppSettings and ConnectionStrings, I get null. the WEB.config file is like this:
Sean C.
  • 1,494
  • 1
  • 13
  • 22
10
votes
5 answers

How to use ConfigurationManager.AppSettings with a custom section?

I need to get "http://example.com" from using App.config file. But at the moment I am using: string peopleXMLPath = ConfigurationManager.AppSettings["server"]; I cannot get the value. Could you point out what I am doing wrong?
GibboK
  • 71,848
  • 143
  • 435
  • 658
10
votes
1 answer

ASP.NET Web.config AppSettings Performance

I have a number of appSettings in web.config that are used frequently (i.e. on each post back). Does the ConfigurationManager hold these values in process or are there any performance gains to be had by copying these values into application state…
Oundless
  • 5,425
  • 4
  • 31
  • 33
10
votes
4 answers

Change in AppSettings needs restart my Application how can I avoid?

I'm using C# .NET 2.0 Windows Application. and I'm using app.config for my Application Settings. but change in AppSettings doesn't reflected runtime, it Needs Application to be restarted. How can I avoid it. Here is my code snippet I used to read…
shahjapan
  • 13,637
  • 22
  • 74
  • 104
9
votes
1 answer

Inject IConfiguration into Program.cs (Console App) in .NET Core 3.0

I am trying to inject IConfiguration (Microsoft.Extensions.Configuration package) into Program.cs and don't know if that is possible and therefore obviously don't know how to do it, if possible. I've done it in the Startup class in other projects,…
nelion
  • 1,712
  • 4
  • 17
  • 37
9
votes
3 answers

Working on multiple SVN branches in 1 Eclipse Workspace

Is it possible to have 1 workspace which contains different branched copies of the same project? Say I have Project1, and it is in this structure: /trunk/Project1 /branches/1/Project1 /branches/2/Project1 Can I have 3 instances of Project 1 in the…
Zombies
  • 25,039
  • 43
  • 140
  • 225
9
votes
1 answer

How can I retrieve AppSettings configuration back in Asp.Net MVC 6?

Assuming that I am using the new DepencyInjection framework to configure my classes and dependencies in the new ASP.Net/vNext. How can I use, How can I get my pre-defined configuration settings? public void ConfigureServices(IServiceCollection…
J. Lennon
  • 3,311
  • 4
  • 33
  • 64
9
votes
2 answers

How to update appSettings in a WPF app?

Greetings to all! This is my first question here on stackoverflow. I have a WPF application that I am writing for the fellow developers in my department, and there are a couple of settings that I need to check for at startup and update if they are…
James McConnell
  • 2,180
  • 3
  • 19
  • 29
9
votes
4 answers

Change Azure website app settings from code

Is it possible to change the app settings for a website from the app itself? This is not meant to be an everyday operation, but a self-service reconfiguration option. A non-developer can change a specific setting, which should cause a restart, just…
Diego Mijelshon
  • 52,548
  • 16
  • 116
  • 154
8
votes
3 answers

.Net Core Worker Service appsettings.json not being read

I created a .net core worker service, had IConfiguration injected into it so I can read a property from appsettings.json but everytime I run the file the property comes up as null. However if I force the IConfiguration to add a json file via the…
guimar86
  • 81
  • 1
  • 1
  • 4
8
votes
4 answers

Why does the configuration of .NET Core options not work with a generic type parameter?

I have a .NET Core WebApi project. To read the appsettings in an easy way, I configure the options to be injected with DI. This works fine. However if I try to call Configure<>() with a generic type parameter, I get an error. Argument 2: cannot…
Emaro
  • 1,397
  • 1
  • 12
  • 21
8
votes
2 answers

How does one Transform AppSettings in ASP.NET Core

I was led to believe that appsettings.json and its environment counterparts (dev, staging, production) replaced Web.config transforms. This works fine in a dev environment, where variables for those environments exist in the…
onefootswill
  • 3,707
  • 6
  • 47
  • 101