In order to set a Environment variable for the IIS hosted app via web.config we need to add <EnvironmentVariables>
element inside the <aspNetCore>
element.
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
Example of your config should look like this:
<aspNetCore processPath="dotnet" arguments=".\YourApp.dll"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
hostingModel="inprocess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
Top comments (1)
Great article on setting the ASPNETCORE_ENVIRONMENT variable in web.config for IIS-hosted ASP.NET Core applications! For developers working on macOS who need to run .NET Framework 4 applications without setting up a virtual machine, ServBay offers a seamless solution. It's been a game-changer for my development workflow.