Deploy a core ASP.NET application for IIS on Windows Server 2019. (2023)

Posted on March 16, 2019 inASP.NET-Kern,developer,IIS- 4 comments

This is Part II of a series of blog posts where I share some ways to build and deploy a core ASP.NET application for IIS running in a Windows VM. In whichprevious post, covers creating and publishing a core ASP.NET application. The end result is an artifact (a published directory). In this post, I'll cover how to implement the artifact in IIS. Along the way, we'll discuss:

  • IIS is on
  • .NET Core Runtime e Hosting-Bundle
  • Configuring IIS Applications and Websites
  • IIS Application Pool


Here are the steps for deploying a typical basic ASP.NET application to IIS for the first time.

  1. IIS is enabled.
  2. Install the .NET Core hosting and runtime package.
  3. Create and configure the IIS root application and website
    1. Create and configure the application pool.
    2. Create an IIS website.
      • add links
      • SSL certificate
      • Set the physical path to the directory containing the application files.
  4. If you're deploying the app as a separate app from the root app, create and configure the app on the site.
    • Set the physical path to the directory containing the application files.

IIS is on

Follow these steps to verify and enable IIS as needed:

  1. open server manager
    • You can search for it in the Start menu.
  2. In Server Manager, on the Quick Launch, click Add Roles and Features. The Add Features and Feature Wizard window will appear.
  3. Click Next.
  4. Under Select installation type, check "Role-based or role-based installation".
  5. Under Select Destination Server, select the server on which you want to enable IIS and click Next.
  6. Under Server Roles, enable "Web Server (IIS)".
    • The system automatically selects default modules for IIS. In addition to the standard components, you can also install the Application Initialization module in Application Development if you want the application to start automatically instead of waiting for the first request. See my post for more details:How to automatically start an ASP.NET Core web app and keep it running in IIS.
  7. Click Next.
  8. Click Install.

.NET Core Runtime e Hosting-Bundle

If you choose to use Framework Dependent Deployment (FDD) when publishing your app, the server running your app must have the appropriate .NET Core runtime installed. Run the following command to check the available runtime on a server:


To use: To use the dotnet command tools, you must install theSDK.

Below is an example of .NET Core runtimes installed in a Windows virtual machine.

Installed .NET Core runtimes:
Microsoft.AspNetCore.All 2.1.3 [C:\Programa\dotnet\shared\Microsoft.AspNetCore
Microsoft.AspNetCore.All 2.2.2 [C:\Programa\dotnet\shared\Microsoft.AspNetCore
Microsoft.AspNetCore.App 2.1.3 [C:\Programa\dotnet\shared\Microsoft.AspNetCore
Microsoft.AspNetCore.App 2.2.2 [C:\Programa\dotnet\shared\Microsoft.AspNetCore
Microsoft.NETCore.App 2.1.3 [C:\Programa\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.2 [C:\Programa\dotnet\shared\Microsoft.NETCore.App]

The above runtimes mean that the server can support any FDD of an app targeting .NET Core between 2.0.0 and 2.2.2, thanks to the rollforward feature available from .NET Core 2.0.0.

Download and install the latest hosting and runtime package. As of this writing, the latest .NET core stable runtime is 2.2. you can find ithere.

Caution: You must enable IIS first before installing the runtime and hosting package. If you install the package without activating IIS, you must run setup again and select repair after activating IIS.

(Video) How to Deploy and Configure ASP.NET Core API in IIS windows server 2019.

Restart the server after installation.

application groups

Basically, an application pool allows you to control the resources of a web application. For example, you can have multiple applications share the same resources by assigning them to the same group, or you can assign dedicated resources to an application by assigning the application to an application group separate from other groups.

An application group also acts as a sandbox to effectively isolate applications within the group from applications in another group. If an application running in one application pool crashes or causes problems, applications running in another application pool will not be affected. You can have multiple apps sharing the same group, and you can also have multiple groups for different apps. Each application group represents a worker process. So the more application pools you have, the more memory you need.

When you stop a group of apps, you essentially stop the apps associated with the group.

local do IIS

A website is a container for web applications. Each site has a default root application, and you can create additional applications on the site. All apps on the same site share the same root URL (link).

Although apps on the same site use the same links, each app can have its own app group. Therefore, you can still achieve application isolation when hosting multiple applications on the same website. Of course, you can also host multiple apps in multiple locations.

You can host multiple applications on the same site to reuse DNS or if the applications are closely related. Suppose you have two related applications; maybe two different API versions of the same application. You can host both apps on the same website. Both have the same root URL but different end paths (eg and


A site binding essentially tells IIS that a site can process a request if the request header matches one or more parts of the binding. The main parts of a link are the type, IP address, port and hostname. When an incoming request arrives at the server, IIS can determine which site is best suited to handle the request based on the sites' bindings.

A bond mainly consists of:

Type: http or https. With https, you can associate an SSL certificate with the link.

hostname: One or more hostnames can be assigned to a server. Default is blank or localhost. The hostname in the request address must match the hostname in the link for the site to process the request.

porto: The TCP port number. This is a required configuration. Specify the port number to which you want to link the site. The port number specified in the request address must match the port number in the site binding to process the request.

(Video) Deploy and Host ASP.NET CORE Application on IIS

IP address: More than 1 IP address can be assigned to a server. When configuring a link to a website, you can select a specific IP assigned to a server. You can also select the All Unassigned value, which means all IP addresses that have not been assigned to other IIS sites. If the request address is in the form of an IP address, the request IP address must match the mandatory IP address of the website to process the request.

SSL certificate

An SSL certificate is used to prevent secure communication between a server and a clientthe man in the middleAttack.

Here's a summary of how SSL works. For more details see theArticle.

How to get an SSL certificate:

  1. Create a certificate signing request.
  2. Submit the certificate signing request to a certificate authority (CA). The request contains the public key.
  3. The CA creates the certificate based on the public key. You don't know the private key.
  4. Install the certificate on your server.

Communication between browser and server via SSL:

  1. The browser creates a session key and encrypts it with the server's public key.
  2. The browser sends the encrypted key to the server.
  3. The server decrypts the session key with its private key.
  4. The browser and server now encrypt and decrypt the data with the session key, which is known only to the browser and the server.

You can also use a self-signed certificate for testing purposes. look thismail.

Deploy a sample ASP.NET Core app

For demonstration purposes, I've created and published a simple basic ASP.NET application. The app targets .NET Core 2.2.

On the remote server I have the published folder at "C:\inetpub\MyAspNetCoreApp".

I. Create IIS Application Pool

To create an application group,

  1. In IIS, click on the server name.
  2. Select "Application Pools" and right-click.
  3. Click Add Application Pool. to open the Add Application Pool dialog.
  4. For Name, enter "MyAspNetCoreAppPool".
  5. Under .NET CLR Version, select No Managed Code.
  6. For Managed Pipeline Mode, leave the default setting of Integrated.
  7. Check the Start application pool immediately box.

.NET CLR version:

The .NET CLR version refers to the version of the common language runtime that includes the .NET Framework. Since, in this example, we are deploying a core ASP.NET application targeting the .NET core and not the .NET core, we chose No Managed Code.

Shows the .NET Framework version used by an application pool. If the application pool has been configured to not use the .NET Framework, the value isNo managed code.

(Video) Configuring a Web Server for Web Deploy Publishing (Web Deploy Handler)Windows server 2016/2019

application groups

Managed plumbing mode: integrated versus classic

this stack overflowmailtalks about the differences between integrated and classic modes. The main points comedocumentation🇧🇷 Below is just my summary.

Integrated mode is the latest mode available since IIS 7.0. Integrated mode unifies the processing models of IIS and ASP.NET. In integrated mode, an ordered list of events processes a request and generates a response.

Classic mode separates the rendering models of IIS and ASP.NET. In classic mode, a request goes through native processing in IIS. It then passes through Aspnet_isapi.dll for managed code processing.

Some of the processing steps, e.g. Handlers such as authentication and authorization are the same in the IIS and ASP.NET processing models. Therefore, it is less efficient than integrated mode because one request must be processed twice. If you are deploying a new application, be sure to choose integrated mode.

II Create an IIS site.

  1. In IIS, under Sites, right-click and select Add Site to open the Add Site dialog box.
  2. For Site Name, enter MyAspNetCoreApp.
  3. Click Select to open the Select Application Pool dialog and select the MyAspNetCoreApp pool you created earlier.
  4. Under Physical path, click Browse and select the path to the published app. For this example, I've placed the published app at C:\inetpub\MyAspNetCoreApp.
  5. Enter the information for the link. See the previous section for more details. For this example, just use the default values.
    • Select "http" as the type.
    • Select "All Unassigned" as the IP address.
    • Select 8080 as port
    • Leave the Hostname field blank to use the default localhost.
  6. Click OK to create the site.
  7. Run the app.
    1. Under Sites, select your MyAspNetCoreApp site. In the right pane, under Manage Site, click Start if the site is not already started.
    2. On the server, open your browser and type "http://localhost:8080".

You should see the page load. If so, congratulations.

Next steps:Once your site has been loaded locally, you can configure the link to allow the world to access your site.

  • Add a new link using the DNS associated with your server.
  • USA https.

In the next post, I'll show you how to automate the build and deployment process using Azure Pipelines.

4. Troubleshooting

If you get HTTP 500.19: Internal Server Error. The server might not have the correct .Net Core runtime installed. See this disc.

One way to fix the problem is to run the application directly with the dotnet command.

(Video) Install IIS to Windows Server 2016 Set Web Deploy and Public ASP.Net Core to IIS

Open the command line, CD in the directory with the application files: C:\inetpub\MyAspNetCoreApp. Then type the command

dotnet AspNetCoreApp.dll

You should be able to browse the app on port 5000.

V. What next?

read my nextmailIn this series, you'll learn how to automate the build and deployment process to save time, reduce human error, and focus more on building your app.


Create and publish a core ASP.NET application with Visual Studio 2017.

Quick Reference: IIS Application Pool

application groups

Understand IIS bindings, websites, virtual directories, and ultimately application pools

Differences between Integrated and Classic mode in App Pool

SSL certificate

How to configure website links in Internet Information Services (IIS).

hang tags:application pool,dotnet core runtime and hosting package,is required,their website

(Video) How to publish a .Net Web API in IIS Windows Server (http & https


1. Enabling IIS on Windows Server 2019
(Tai Bo)
2. Deploy Core 3.0 application on IIS
3. ASP.NET Core 3.1 - Host / Deploy Application in IIS
(Jigar Patel)
4. Deployment of dot net 6 app to local IIS server
(Ravindra Devrani)
5. How to Deploy ASP.NET Core Application on IIS in Self Contained Mode
6. Deploying a Net Core app onto a Windows Server
(Oscar's Angular Channel)
Top Articles
Latest Posts
Article information

Author: Zonia Mosciski DO

Last Updated: 03/03/2023

Views: 5704

Rating: 4 / 5 (71 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Zonia Mosciski DO

Birthday: 1996-05-16

Address: Suite 228 919 Deana Ford, Lake Meridithberg, NE 60017-4257

Phone: +2613987384138

Job: Chief Retail Officer

Hobby: Tai chi, Dowsing, Poi, Letterboxing, Watching movies, Video gaming, Singing

Introduction: My name is Zonia Mosciski DO, I am a enchanting, joyous, lovely, successful, hilarious, tender, outstanding person who loves writing and wants to share my knowledge and understanding with you.