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
-1
votes
1 answer

How to traverse the properties in the appSettings class, with configuration from appSettings.json

I have an appSettings.json file with the following group: "Devices": { "_850347_74Crompton1": "3605", "_850532_41Crompton2": "813", "_850722_18IMEElectricity": "707", "_850766_85DustNoise1": "306", "_850772_63Dustnoise2": "2866", …
Fandango68
  • 4,461
  • 4
  • 39
  • 74
-1
votes
1 answer

How to save Settings at runtime in C# Winforms App

I am developing a fairly basic winforms app in .Net 6 that has some settings that I need to save locally at runtime. THis piece of Code Properties.Settings.Default["comPort"] = cboComPorts.Text; I get the…
Martin Thompson
  • 3,415
  • 10
  • 38
  • 62
-1
votes
1 answer

Creating and reading from appconfig.json

I am trying to create config that will contains a list of servers, with extra values, something like "Servers": [ { "Name": ".", "Type": "A" }, { "Name": "Fred", "Type": "B" } ] Is that the correct way to structure the config file? I then…
-1
votes
1 answer

Is there a way to generate appsettings.json sections from the bound "settings" class?

I'm using strongly typed settings in my .NET 6 Project. I'm binding the appSettings via Hostbuilder's .ConfigureServices((hostContext, services) => { …
DaQookie
  • 31
  • 4
-1
votes
1 answer

Replace entire appsettings.json before build and deploy in azure pipeline

Scenario I have two repos with similar API-code funtionality but for two different type of objects. Sence the functionality is similar, then i have focused on developing one of them and the thought is to reuse it for both APIs for these both object…
B.j
  • 47
  • 1
  • 9
-1
votes
1 answer

How to pass Azure AppSettings to NodeJS App running on Linux AppService

I am running a nestJS app on an Azure Linux AppService. I have added Application Settings within the appService, but I can't seem to get the app to pull through the value. one of the appSettings is process.env.DB_Host with value mysqlserveraddress…
user11455801
-1
votes
1 answer

How to access the username and password from appsettings file to program.cs in c#

I am implementing a console application to build application pool status.I referred check the status of IIS Application Pool of getting the username and password from database,I wanted to get them from appsettings.json. The problem I am having is…
Jandi
  • 11
  • 5
-1
votes
1 answer

what is the purpose of DirectoryEntry class?

I want to develop a console application using C# which gets the IIS Application Pool status information,whether its running or stopped.For this I referred check the status of IIS Application Pool which matches my requirement. Can someone please…
Jandi
  • 11
  • 5
-1
votes
1 answer

appSettings when read by microsoft.Extensions.Options IOptions not working after deployment

Project type: asp.net core 2.2 (console application) web api I'm using Dependency Injection of microsoft.Extensions.Options IOptions to get configuration appsettings.json into the controller. It is working fine on my local development machine.…
-1
votes
2 answers

Access appsettings.json custom section inside my asp.net core console application

I have the following appsettings.json inside my Asp.NET core console application:- { "ConnectionStrings": { "ConnectionString": "Server=localhost;Database=ServiceDesk;Trusted_Connection=True" }, "SP": { "SiteURL":…
John John
  • 1
  • 72
  • 238
  • 501
-1
votes
2 answers

How to get full path of file using File.WriteAllText in C#?

I have added key in settings file as .I need to pass this path to File.WriteAllText and concatenate as c:/Data/Test/XML_Files/TestFile but the path is taken only till…
-1
votes
1 answer

C# appsetttings bind array of objects to class

I have int appsettings.js section like that: "AccessKeys": { "user1": { "pass": "" }, I created classes in C# to bind this section to these classes: public class AccessKeys { public List Users = new List(); } public class…
Robert
  • 2,571
  • 10
  • 63
  • 95
-1
votes
1 answer

How can I have my appSettings.json override my web.Config in .NET core?

I need the web.Config for CI CD when I deploy to IIS (for angular routing) but when I run locally and switch environment variables I want it to look at the appSettings. But now when the Web.Config is there it is looking for the env variables there…
punkouter
  • 5,170
  • 15
  • 71
  • 116
-1
votes
1 answer

Special Character in Azure appsettings

Am hosting the API project in azure devops. I have set the connectionstring in the keyvault, passing the value to Appsettings. In the password,'&' character is present. Hence i set the password in connectionstring as 'Test&test', but upon fetching…
shiju
  • 11
  • 8
-1
votes
1 answer

ConfigurationManager.AppSettings returns null for a simple console app

I've checked all obvious pitfalls and this is weird Program.cs static void Main(string[] args) { var set1 = ConfigurationManager.AppSettings["Setting1"]; //set1 is null } and App.config
Toolkit
  • 10,779
  • 8
  • 59
  • 68
1 2 3
70
71