Since RC2, hosting .Net Core apps within IIS is no longer using the common HttpPlatformHandler as with any other processes but instead the ASP.NET Core Module for Windows Server Hosting.
While not a lot has changed, the Xml schema for the web.config elements is new, so you need to specify environment variables the following way in your main web.config file:
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> </handlers> <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" forwardWindowsAuthToken="false" stdoutLogEnabled="true" > <environmentVariables> <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" /> </environmentVariables> </aspNetCore> </system.webServer> </configuration>
Alternatively, you can still use regular web.config transformations for publishing to IIS (there's currently no support for that in dotnet-publish-iis), for example in your web.Production.config:
<?xml version="1.0" encoding="utf-8"?> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <system.webServer> <aspNetCore> <environmentVariables xdt:Transform="Insert"> <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" /> </environmentVariables> </aspNetCore> </system.webServer> </configuration>