Monday, January 23, 2017

ASP.NET Core: Set the environment on your Powershell prompt

While trying to run our ASP.NET Core application from the commandline using ‘dotnet run’ we got the following warning:

Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.
Makes sense, however in this case we would like to run the application using “Development” as the configured environment. 

How can we do that?

From the command prompt:

dotnet run

From Powershell:

dotnet run
Remark: Note that the environment change will only apply to the current window. So it is important to run both commands from the same command prompt 

No comments: