ASP.NET Core apps run behind IIS through the ASP.NET Core Module, which ships in Microsoft's .NET Hosting Bundle. The bundle also installs the.NET and ASP.NET Core runtimes, so it is the one download you need on a web server.
1. Install IIS first
The hosting bundle registers itself with IIS, so IIS must already be installed. If it is not, follow Install IIS and host a website and come back.
Note: If you install the bundle before IIS, run the bundle installer again afterwards and choose Repair.
2. Find the version your app needs
Check your project file for the target framework, for example <TargetFramework>net8.0</TargetFramework>. Install the hosting bundle for that major version. Several versions can be installed side by side.
3. Download and install the bundle
- On the server, open dotnet.microsoft.com, go to Download.NET, and choose your version.
- Under ASP.NET Core Runtime, download Hosting Bundle for Windows.
- Run the installer as Administrator.
- Restart IIS so it loads the new module:
net stop was /y
net start w3svc4. Confirm what is installed
dotnet --list-runtimesYou should see Microsoft.AspNetCore.App and Microsoft.NETCore.App for your version.
5. Publish and host the app
- On your development PC, publish the app:
dotnet publish -c Release -o./publish. - Copy the
publishfolder to the server, for example toC:\inetpub\myapp(ways to copy files). - In IIS Manager, open Application Pools, select your site's pool and set .NET CLR version to No Managed Code. ASP.NET Core runs in its own process, not the classic CLR.
- Point the site's physical path at
C:\inetpub\myappand browse to it.
Troubleshooting
- HTTP Error 500.19 (0x8007000d): the ASP.NET Core Module is missing. Install or repair the hosting bundle, then restart IIS.
- HTTP Error 500.30 / 500.31: the app failed to start or the right runtime is missing. Run the app's
.exefrom the publish folder in a terminal to see the real error, and compare withdotnet --list-runtimes. - Need to see logs: set
stdoutLogEnabled="true"in the app'sweb.configtemporarily and create thelogsfolder it points to.
