For when you don't want to set the environment variable in the web.config file, because that gets deployed.
Go into configuration editor
In the section choose system.webServer/aspNetCore
and then in the From drop down choose the ApplicationHost.config option
There you can add environmentVariables which need to be
ASPNETCORE_ENVIRONMENT
and
Development or Production