ASP.NET Core ignores ASPNET_ENV and Hosting:Environment

Viewed 4293

No matter when or where I set either ASPNET_ENV or Hosting:Environment the startup code will always enter

//This method is invoked when ASPNET_ENV is 'Production'
//The allowed values are Development,Staging and Production
public void ConfigureProduction(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
   loggerFactory.AddConsole(minLevel: LogLevel.Warning);

   Configure(app);
}

enter image description here

What I've tried so far

  • Set Hosting:Environment to Development in the project properties
  • Set ASPNET_ENV to Development in the project properties
  • Set Hosting:Environment to Development in launchSettings.json
  • Set ASPNET_ENV to Development in launchSettings.json
  • Set ASPNET_ENV to Development in code via Environment.SetEnvironmentVariable("ASPNET_ENV", "Development"); in the Startup method before the call to ConfigurationBuilder.GetEnvironmentVariables()

This is version 1.0.0-rc2-20143 by the way. Am I missing something here or is it just a bug?

4 Answers
Related