IIS: Configure ASP.NET Core environment variables using different configuration files

Expect to use different configuration files in different environments, there are many ways to do this, refer to:

The way I use is to configure the environment variable: ASPNETCORE_ENVIRONMENT, the default standard environment names are:

  • Development local
  • Staging testing
  • Production production

Of course, it can be set to any environment name, and their corresponding configuration files are appsettings.{Environment}.json (in today's core, the environment variable file for .AddJsonFile has been configured, no need to configure manually).

Then, because I am using IIS, the way to configure environment variables in IIS is:

Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.