The MSDN documentation does not explain how, when or why this value is set to true.
Setting <configuration debug="false" />
in web.config does not set the property to false, nor does setting <deployment retail="true" />
in machine.config.
I'm running the test website from Visual Studio 2012 on IIS Express, I do not have IIS 'proper' installed.
Edit:
After reviewing Oscar's answer and doing some more research, it seems that setting <deployment retail="true" />
should override, so I probably didn't set it in the right framework's machine.config when I asked this question.
To determine the runtime environment, ASP.NET Core reads from the following environment variables: DOTNET_ENVIRONMENT. ASPNETCORE_ENVIRONMENT when ConfigureWebHostDefaults is called. The default ASP.NET Core web app templates call ConfigureWebHostDefaults .
To set the ASPNETCORE_ENVIRONMENT environment variable in Windows: Command line - setx ASPNETCORE_ENVIRONMENT "Development" PowerShell - $Env:ASPNETCORE_ENVIRONMENT = "Development"
Environment Variables are one of the sources from which ASP.NET Core reads the configuration values. In this tutorial, let us learn how to set Environment Variables in Windows, Mac, Linux, IIS Server, Visual Studio, Visual Studio Code & dotnet run. We also learn how to read them in ASP.NET core.
The decompiled code of this property is as follows:
public static bool IsDevelopmentEnvironment
{
get
{
return ((AppDomain.CurrentDomain.GetData(".devEnvironment") as bool?) == true);
}
}
But I couldn't fin where this value is set.. :-(
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With