ASP.NET Core environment
The ASP.NET Core environment is a named runtime setting, commonly specified by ASPNETCORE_ENVIRONMENT, that identifies the hosting context and controls environment-specific behavior and configuration.
Building Web APIs with ASP.NET Core
ASPNETCORE_ENVIRONMENT is an environment variable that specifies the runtime environment in which an ASP.NET Core application runs.
- How it is used
- Selects runtime-specific configuration and API behavior for development, testing, or production.
- How deep it goes
- Walks through local setup, configuration overrides, and middleware testing; defers production-server setup.
- Examples
- Uses Development launch profiles and a throwing /error/test endpoint to compare developer and production-style error responses.
- What you can do after
- Operate/configure it by setting a local launch profile, overriding development settings, and verifying the selected exception handler.
Read how Building Web APIs with ASP.NET Core explains ASP.NET Core environment →
ASP.NET Core in Action, 3e
ASPNETCORE_ENVIRONMENT is an environment variable that identifies the current ASP.NET Core hosting environment.
- How it is used
- Selects environment-specific application behavior and configuration across development, staging, and production deployments.
- How deep it goes
- Defines variable loading, precedence, defaults, helper checks, and environment-specific files, but does not detail broader application customization.
- Examples
- Uses Development, Staging, Production, launchSettings.json, and appsettings.Production.json as concrete environment examples.
- What you can do after
- Operate/configure an application by setting its hosting environment and selecting matching configuration files.
Read how ASP.NET Core in Action, 3e explains ASP.NET Core environment →
Related concepts
- environment variablekind of · An environment variable is a named value supplied through an operating-system or process environment and made available to programs for runtime configuration or information.
- appsettings.Development.jsonconfigures · appsettings.Development.json is an ASP.NET Core environment-specific JSON configuration file whose settings apply when the Development environment is active.
- IHostEnvironmentconfigures · IHostEnvironment is the .NET abstraction that exposes information about an application's current hosting environment and content root.
- environmentconfigures · An environment is the external context, including its entities and conditions, in which a system, process, or agent exists or operates.
- JavaScript runtimeconfigures · A JavaScript runtime is an execution environment that runs JavaScript code and provides the language engine and host APIs needed to interact with its platform.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

