Showing posts with label Configuration. Show all posts
Showing posts with label Configuration. Show all posts
Friday, April 10, 2020
Thursday, April 9, 2020
Access configuration settings from custom configuration files
In the previous post we
saw on how to read configuration settings from the appsettings.json file. While this holds good for most of the cases,
there might be situations where we will need our custom configuration file,
when we use our own configuration file, we need to specify the file in the
Startup and add the file to the ConfigurationBuilder.
In the below case we have a custom configuration file mysettings.json, and we will read the configuration settings from our config file.
In the below case we have a custom configuration file mysettings.json, and we will read the configuration settings from our config file.
Access configuration settings from appsetting.json
We saw about the various
configuration options provided by .Net
Core in the previous post. In this post we shall see on how to use the
configuration file option to store and retrieve key-value configuration settings.
Traditionally we are used to store configuration settings in environmental variables or config files like .INI files, web.config files etc. Asp.Net core provides a default JSON based configuration file called appsettings.json file. In this post we shall see on how to read configuration settings from the appsettings.json file in the application startup.
Traditionally we are used to store configuration settings in environmental variables or config files like .INI files, web.config files etc. Asp.Net core provides a default JSON based configuration file called appsettings.json file. In this post we shall see on how to read configuration settings from the appsettings.json file in the application startup.
Asp.Net Core Configuration
Configuration settings
is an important part of any large application. We will have to store and use
various config settings like connection string, file path etc in an
application. In the older version of Asp.Net Applications configuration
settings were stored in web.config
files which is an XML file. The System.Configuration
namespace was used to read key-value pairs from XML configuration file
web.config.
Asp.Net Core provides
various options to store and retrieve configuration settings. Following are
some of the options provided by Asp.Net
Core to store and retrieve configuration settings.
Subscribe to:
Posts (Atom)

