ASPNETCORE_ENVIRONMENT

When you publish an ASP.NET Core app to IIS you will need the following setting in your Web.Config file in order to retrieve the value. Normally, in development in Visual Studio, you have this setting in launchSettings.json file. However, this file is not published so the variable needs to be in the Web.Config file.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <!-- 100 MB in KB -->
    <httpRuntime maxRequestLength="102400" executionTimeout="3600" />
  </system.web>

  <system.webServer>
    <security>
      <requestFiltering>
        <!-- 100.5 MB in bytes -->
        <requestLimits maxAllowedContentLength="105857600" />
      </requestFiltering>
    </security>

    <aspNetCore processPath=".\ApplicationName.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
      <environmentVariables>
        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="DEV" />
      </environmentVariables>
    </aspNetCore>
    
  </system.webServer>
</configuration>

 

Add comment

Loading