Steps Required to Host a .NET Core 2 Application on IIS

Scott Walker · May 20, 2019
Steps Required to Host a .NET Core 2 Application on IIS

Before a .NET Core 2.x web application can run under IIS, several configuration steps must be completed. Unlike classic ASP.NET, .NET Core apps rely on the ASP.NET Core Module and the Hosting Bundle to forward IIS traffic to the Kestrel web server.

  1. Install IIS if it is not already installed. Ensure the required IIS features are enabled (Static Content, Default Document, IIS Management Console, etc.).
  2. Copy your published application files to the server, including the web.config file generated during publishing.
  3. Create a new IIS Website if needed, pointing it to your application folder.
  4. Set the Application Pool to No Managed Code. .NET Core apps do not run inside the CLR; IIS simply proxies requests to Kestrel.
  5. Install the .NET Core 2.2 Runtime & Hosting Bundle. This installs the ASP.NET Core Module required for IIS integration.
  6. Restart IIS using iisreset to ensure the new module is loaded.
  7. Open PowerShell with administrative privileges.
  8. Download the Provision-AutoGenKeys.ps1 script from Microsoft’s documentation. This script ensures proper Data Protection key generation for IIS-hosted Core apps.
  9. Enable script execution: powershell -ExecutionPolicy RemoteSigned
  10. Run the PowerShell script to configure Data Protection keys.

After completing these steps, your .NET Core 2 application should run smoothly under IIS using the ASP.NET Core Module.

.NET Core IIS

Comments (0)

Please sign in to comment.