April 27, 2026

Deploying .NET Core Web API to IIS on Windows Server (Fix HTTP 500.19 Error)

Introduction

Deploying a .NET Core Web API to IIS on Windows Server is a standard requirement in enterprise environments. However, many developers encounter deployment failures such as HTTP Error 500.19 (Error Code: 0x8007000d) immediately after publishing.

This error is rarely complex. It is almost always caused by missing prerequisites, incorrect IIS configuration, or an improperly installed Hosting Bundle.

This guide walks you through the complete IIS deployment process step-by-step - and explains exactly how to diagnose and resolve HTTP 500.19 errors with confidence.

Prerequisites

Before beginning deployment, ensure the following components are installed and ready:

  • Windows Server installed and accessible
  • IIS (Internet Information Services) installed and running
  • .NET Core / .NET Hosting Bundle installed (version must match your project)
  • Visual Studio project built successfully in Release mode
  • Published output folder generated and accessible

Important: The Hosting Bundle version must precisely match your target framework (.NET 6, 7, 8, etc.). A version mismatch is one of the most common root causes of HTTP Error 500.19.

01 Install IIS

Open Server ManagerAdd Roles and Features → Select Role-based installation → Choose your server → Select Web Server (IIS).

During feature selection, ensure the following are included:

  • Web Server (IIS)
  • Application Development Features
  • .NET Extensibility
  • ASP.NET Core Module (if available)
  • Management Tools
  • IIS Management Console

Command - Verify IIS Manager

inetmgr

Run this command in the Run dialog (Win + R) to confirm IIS Manager opens successfully.

02 Install .NET Core Hosting Bundle

Download the Hosting Bundle from the official Microsoft .NET download page and install the version that precisely matches your project's target framework. Running a mismatched version is a leading cause of 500.19 errors and should be verified before any other troubleshooting.

Command - Restart IIS After Installation

iisreset

After installation, always restart IIS to ensure the .NET Core Module is properly registered.

03 Select Publish Target

  • Right-click your project in Solution Explorer → Click Publish
  • Select Folder as the publish target → Click Next
  • Provide a publish path, e.g.: C:\Users\YourName\Desktop\PublishedFolder
  • Click Finish to save the publish profile

04 Publish the Web API

  • Set Configuration to Release
  • Set Deployment Mode to Framework-dependent
  • Confirm Target Framework matches your project version
  • Enable Delete all existing files prior to publish to avoid stale artifacts
  • Click Publish and wait for the process to complete

Once published, copy the output folder to the IIS web root directory:

C:\inetpub\wwwroot\MyWebApi

05 Create Application Pool

  • Open IIS Manager → Click Application Pools
  • Click Add Application Pool in the Actions panel
  • Name: MyApiPool
  • .NET CLR Version: No Managed Code (required for all .NET Core apps)
  • Managed Pipeline Mode: Integrated

Setting the .NET CLR Version to No Managed Code is critical. .NET Core manages its own runtime independently and does not rely on the IIS CLR. Selecting a CLR version here will cause application pool startup errors.

06 Create Website in IIS

  • In IIS Manager, right-click Sites → Click Add Website
  • Site Name: MyWebApi
  • Physical Path: point to your published output folder
  • Application Pool: select MyApiPool (created in Step 05)
  • Binding Port: 80 (or a custom port such as 5000)
  • Click OK to create the site

07 Configure Windows Firewall (For Custom Ports)

If your IIS website is configured to use a custom port (e.g., 5000), you must create an inbound firewall rule to allow traffic on that port. Without this step, external requests will be blocked silently by Windows Firewall.

  • Press Win + R, type wf.msc, and press Enter
  • Click Inbound RulesNew Rule
  • Select Port as the rule type → Click Next
  • Choose TCP and enter 5000 under Specific local ports
  • Select Allow the connection → Click Next
  • Apply to profiles: Domain, Private, and Public
  • Name the rule MyWebApi Port 5000 → Click Finish

After the rule is created, verify connectivity by navigating to:

http://your-server-ip:5000

Common Issue: HTTP Error 500.19 - Internal Server Error

Error Code: 0x8007000d  |  HTTP Status: 500.19 – Internal Server Error

This error consistently points to one of the following root causes:

  • Hosting Bundle not installed - or the version does not match the target framework
  • Corrupted or invalid web.config - IIS cannot parse the configuration file
  • Missing AspNetCoreModuleV2 - module not registered after Hosting Bundle installation
  • Incorrect Application Pool configuration - CLR version not set to No Managed Code

Diagnosis Tip: After each corrective action, run iisreset from an elevated command prompt and re-test. Most 500.19 errors resolve after reinstalling the correct Hosting Bundle version followed by an IIS restart.

Conclusion

The majority of HTTP 500.19 errors are environment configuration issues - not application code problems. By correctly installing IIS, precisely matching the Hosting Bundle version to your target framework, setting the Application Pool to No Managed Code, and opening the required ports in Windows Firewall, you can deploy your .NET Core Web API reliably and predictably on any Windows Server environment.

Follow these steps in sequence, validate each stage before proceeding to the next, and run iisreset after any configuration change to ensure changes take effect immediately.

No comments:

Post a Comment