Publishing and Running ASP.NET Core Applications with IIS (edit)

Install .NET Core, ASP.NET Core

Install DotNetCore.1.0.0-WindowsHosting.exe (DotNetCore.1.0.0-WindowsHosting.exe)

DotNetCore 1.0.10

The ASP.NET Core Hosting Bundle includes the .NET Core runtime and ASP.NET Core runtime.

How to detect .NET Core installed versions?

.NET Framework

.NET Core

dotnet --info

dotnet --version

  • dotnet executable
    C:\program files\dotnet\dotnet.exe

  • .NET SDK
    C:\program files\dotnet\sdk\{version}\

  • .NET Runtime
    C:\program files\dotnet\shared\{runtime-type}\{version}\

How to determine if .NET Core is installed using PowerShell

(dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'shared\Microsoft.NETCore.App')).Name
(dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'sdk')).Name

ASP.NET Core Applications in IIS

Hosting ASP.NET on IIS

ASP.NET Core Applications with IIS

ASP.NET Core IIS Hosting

As of ASP.NET Core 2.2 IIS Hosting does support a new InProcess hosting mechanism. A seperate post describes the details of In Process/Out of Process hosting.

The AspNetCoreModule has to be installed on your server and is part of the ASP.NET Core Server Hosting Bundle.

The ASPNetCoreModule interfaces ASP.NET Core Console Applications

Here's what the web.config looks like:

<?xml version="1.0" encoding="utf-8"?>
    Configure your application settings in appsettings.json. Learn more at
      <add name="aspNetCore" path="*" verb="*"
        modules="AspNetCoreModule" resourceType="Unspecified" />
    <aspNetCore processPath="dotnet"
                forwardWindowsAuthToken="false" />

You can see that module references dotnetexe and the compiled entry point DLL that holds your Main method in your .NET Core application.

You can also provide an optional section for Environment Variables if you were explicitly configuring various configuration startup environment settings.


<aspNetCore processPath="dotnet"
        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />

Note that you should use these settings sparingly and rather rely on the configuration settings object which gives you more control. Limit environment variable settings for specific startup options you need to configure the global environment. Otherwise stick to configuration file settings - or on Azure use the application settings to merge values into your config.

IIS Identity and Permissions

You might also have to tweak the IIS App Pool Identity to something other than the default ApplicationPoolIdentity in order to ensure that your application has access to resources it needs to run. I generally start with NETWORKSERVICE and then move to a custom account that matches the actual rights required by the application.

Code Samples for book "Learning Windows Server Containers"