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.
Configuration Settings files like appsettings.json
(JSON, XML or INI files are supported)
Azure Key Vault
Command-line arguments
Environment variables
In-memory .NET objects
Custom providers
In .Net Core, the Microsoft.Extensions.Configuration library is used to read settings from the various configuration options.
Before the app is configured and started, a host is configured and launched. The host is responsible for app startup and lifetime management. Web apps based on the ASP.NET Core call CreateDefaultBuilder when building a host. Host configuration can be specified in environment variables prefixed with ASPNETCORE_. The prefix (ASPNETCORE_) is stripped when the configuration key-value pairs are loaded.
In .Net Core, the Microsoft.Extensions.Configuration library is used to read settings from the various configuration options.
Before the app is configured and started, a host is configured and launched. The host is responsible for app startup and lifetime management. Web apps based on the ASP.NET Core call CreateDefaultBuilder when building a host. Host configuration can be specified in environment variables prefixed with ASPNETCORE_. The prefix (ASPNETCORE_) is stripped when the configuration key-value pairs are loaded.
No comments:
Post a Comment