Set Development Enviroment for a specific .NET Core Web Application

Viewed 34

I've a .Net Core 3.1 web application published on IIS. I want to force enviroment type to development in order to run api that are not allowed in production.

I run the command :

setx ASPNETCORE_ENVIRONMENT "Development"

and then I run:

iisreset

as specified in this article How to set ASPNETCORE_ENVIRONMENT to be considered for publishing an ASP.NET Core application but the enviroment type seems to always remain production.

I try to run the API via a ngrok tunnel. Any suggestion? Thanks. Simone

1 Answers

You need to pass /M flag to setx command:

setx ASPNETCORE_ENVIRONMENT Development /M

The /M switch sets the environment variable at the system level. If the /M switch isn't used, the environment variable is set for the user account.

You can read more about it here

Related