Working with Multiple Environments
ASP.NET Core configures app behavior based on the runtime environment using an environment variable ASPNETCORE_ENVIRONMENT
.
ASPNETCORE_ENVIRONMENT
ASP.NET Core reads the environment variable ASPNETCORE_ENVIRONMENT
at app startup and stores the value in IHostingEnvironment.EnvironmentName
. You can set ASPNETCORE_ENVIRONMENT
to any value, but three values are supported by the framework: Development, Staging, and Production. If ASPNETCORE_ENVIRONMENT
isn't set, it defaults to Production
.
On Windows and macOS, environment variables and values aren't case sensitive. Linux environment variables and values are case sensitive by default.
launchSettings.json
The environment for local machine development can be set in the Properties\launchSettings.json file of the project.
Last updated