DEV Community

Senad Meškin
Senad Meškin

Posted on

ASP.NET Core - IIS Set environment in web.config

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>
Enter fullscreen mode Exit fullscreen mode

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>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)