Users Pricing

blog

Home Blogs Deploy an ASP.NET Core App on IIS: A Beginner's Walkthrough – MindStick
Deploy an ASP.NET Core App on IIS: A Beginner's Walkthrough

Deploy an ASP.NET Core App on IIS: A Beginner's Walkthrough

Ayesha Cheema 19 29 Nov 2026

If you've deployed classic ASP.NET applications on IIS, deploying ASP.NET Core feels familiar, with a few important differences that catch almost everyone the first time. The biggest one: IIS doesn't run your .NET code directly. An IIS module, the ASP.NET Core Module (ANCM), hosts or forwards requests to your application.

This walkthrough takes you from a working project on your machine to a live site on Windows Server with IIS.

Before you start

You'll need:

- Windows Server (or Windows 10/11 for testing) with administrator access
- An ASP.NET Core application targeting a supported .NET version (.NET 10 is the current LTS release)
- Remote Desktop or console access to the server

Step 1: Install IIS

On Windows Server, open Server Manager → Add Roles and Features and install Web Server (IIS). Or use PowerShell:

Install-WindowsFeature -Name Web-Server -IncludeManagementTools

Step 2: Install the .NET Hosting Bundle

This is the step most first-time deployments miss.

Download the ASP.NET Core Hosting Bundle for your app's .NET version from Microsoft's .NET download page. It installs:

- the .NET runtime
- the ASP.NET Core runtime
- the ASP.NET Core Module for IIS

Important: Install IIS before the Hosting Bundle. If you installed IIS afterwards, run the Hosting Bundle installer again and choose Repair.

After installation, restart IIS so it picks up the module:

net stop was /y
net start w3svc

Verify the runtimes:

dotnet --list-runtimes

Step 3: Publish your application

On your development machine:

dotnet publish -c Release -o ./publish

This produces a folder containing your application DLLs, dependencies, static files and a generated web config file.

Framework-dependent vs self-contained

- Framework-dependent (default) — What it means: Uses the runtime installed on the server; When to use: Most IIS deployments; smaller output
- Self-contained (--self-contained -r win-x64) — What it means: Bundles the runtime with the app; When to use: When you can't install runtimes, or need a specific version

Step 4: Copy files to the server

Copy the contents of the publish folder to a directory on the server, for example:

C:\inetpub\apps\MyApp

Avoid deploying into folders under user profiles.

Step 5: Create an application pool

In IIS Manager:

1. Go to Application Pools → Add Application Pool.
2. Name: MyAppPool
3. .NET CLR version: No Managed Code
4. Managed pipeline mode: Integrated

"No Managed Code" looks strange but is correct. ASP.NET Core doesn't use the classic .NET Framework CLR inside IIS; the ASP.NET Core Module handles hosting.

Step 6: Create the website

1. Right-click Sites → Add Website.
2. Site name: MyApp
3. Application pool: MyAppPool
4. Physical path: C:\inetpub\apps\MyApp
5. Binding: HTTP, port 80, and a host name if you're using one (for example app.example.com).

Step 7: Set folder permissions

The app pool runs under a virtual account called IIS AppPool\MyAppPool. Give it Read and Execute permission on the application folder:

icacls "C:\inetpub\apps\MyApp" /grant "IIS AppPool\MyAppPool:(OI)(CI)RX"

If your app writes files (uploads, logs), grant Modify permission only on those specific folders, not the whole application.

Step 8: Understand the generated web config file

Key settings:

- hostingModel="inprocess" (the default) runs your app inside the IIS worker process for best performance.
- stdoutLogEnabled turns on startup logging, which is useful for troubleshooting (see below).

Step 9: Set the environment and secrets

By default, ASP.NET Core runs in the Production environment.

Keep secrets like database passwords out of source control. Use environment variables, protected configuration or a secret store.

Step 10: Browse and verify

Open the site in a browser. If it loads, congratulations. If not, see the troubleshooting section.

Add HTTPS

Never run a production site on plain HTTP. Add an HTTPS binding with a valid certificate. You can use a free Let's Encrypt certificate with automated renewal. (See "How to Secure an IIS Website with a Free SSL Certificate.")

Updating the application

When you publish a new version, IIS may lock DLL files. A clean way to update:

1. Place a file named app_offline.htm in the site folder. The ASP.NET Core Module shuts down the app and serves this page.
2. Copy the new files.
3. Delete app_offline.htm.

Troubleshooting common errors

- 500.19 — Likely cause: Hosting Bundle / ASP.NET Core Module not installed, or invalid web config file; Fix: Install or repair the Hosting Bundle; restart IIS
- 500.30 — Likely cause: App failed to start (exception during startup); Fix: Check Event Viewer and stdout logs. (See "Fixing HTTP Error 500.30 in ASP.NET Core on IIS.")
- 500.31 — Likely cause: Required .NET runtime not found; Fix: Install the matching Hosting Bundle version
- 403.14 — Likely cause: Wrong physical path, or web config file missing; Fix: Point the site to the publish folder
- Access denied errors — Likely cause: Missing folder permissions; Fix: Grant the app pool identity access

Turn on startup logs

1. Create a logs folder in the site directory and give the app pool identity write permission.
2. Set stdoutLogEnabled to true in the web config file.
3. Reproduce the error and check the log files.
4. Turn it off again afterwards. Stdout logs aren't rotated and can fill the disk.

Also check Event Viewer → Windows Logs → Application for entries from the IIS AspNetCore Module.

Deployment checklist

- IIS installed
- Correct Hosting Bundle installed (after IIS)
- App published in Release mode
- App pool set to No Managed Code
- Folder permissions for IIS AppPool\PoolName
- Environment variables and connection strings configured
- HTTPS binding with a valid certificate
- Logging configured and monitored
- Update procedure using app_offline.htm

Once you've done it once, an IIS deployment takes only minutes. Write these steps into a script or CI/CD pipeline, and future releases become routine.


Ayesha Cheema

Associate Software Engineer at Ufone

Working as Associate Software Engineer with Ufone in Islamabad. I have 2 years of experience in mobile app development with Flutter and Kotlin. I did my BS Software Engineering from COMSATS University Islamabad. In my free time I like photography and playing badminton.


Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md