This article will teach you how you can deploy or host you Asp.Net Core 2.0 web application on IIS.  The hosting of Asp.Net Core 2.0 is little different from hosting in Asp.Net. So, let’s understand it step by step.

Program class in core 2.0 contains a method that is called “CreateDefaultBuilder”. It is responsible for setting up everything for your application related to hosting, manage server, IIS integration, create directory etc.

public class Program
   public static void Main(string[] args)

   public static IWebHost BuildWebHost(string[] args) =>

Just gone through with CreateDefaultBuilder method actual definition using F12 in Visual Studio, you can read the comment which specifies its tasks.

Create Default Builder


The deployment is not same as Asp.Net, there is few more component required to host you core 2.0 application on IIS. Before deploying, you have to install a bundle which is required to host Asp.Net Core 2.0 application on IIS and that is.Net Core Windows Server Hosting. This bundle will install .Net Core Runtime which provides all the required library at runtime, .Net Core Library and Asp.Net Core Module.

If you are still using Asp.Net Core 1.x than you can find out the “.Net Core Windows Server Hosting” bundle using the following link and install it.

.Net Core 1.0 Hosting


Here we are using Asp.Net Core 2.0 application to deploy it on IIS, so we are going to download .Net Core Windows Server Hosting bundle from the following link and install it on our system.

.Net Core 1.0 Hosting

When it is in progress, you can see it is installing three main components like .Net Core Runtime, .Net Core Library and Asp.Net Core Module. As you can see in the following image, Microsoft .Net Core Runtime is being installed.

Dotnet Core Runtime

Warning: Please make sure you have restarted your system before moving next after installation of “Microsoft .Net Core Windows Server Hosting” bundles.


For this demonstration, we are using the same Asp.Net Core 2.0 application which we have created in the previous article. To learn how to create a First application in Asp.Net Core 2, please refer to the following article.

First Application In ASP.NET Core MVC 2.0

Let’s move to Visual Studio 2017 version 15.3 which provides .Net Core 2 features.  Open the Asp.Net Core 2.0 application which we have created in the last article. Open the solution explorer and right click to the project and choose Publish option for publishing this web application.

It will open a new window as following, which provide us three different options to publish our web application and these options are “Azure”, “IIS, FTP” and “Folder”. So, here are choosing “Folder” to publish our web content”. You have to provide the destination path where you would like to publish web application and then click to “Publish”.

Publish Folder

It will start publishing content on the selected folder as the following image shown. Once everything will fine, it will show Publish Successes message.

Publish Success

Now it’s time to create a new website inside the IIS Manager, to open IIS Manager, just type “inetmgr” in “Search Program and files” in the start menu. It will open IIS Manager for you as following image shown where you can manage your application.

Just right click to “Sites” and choose “Add Web Site..”.

Add IIS Web Site


In next window, you have to define your “Site Name”, the physical path where you have published your application earlier and hostname to find on the web browser as below image. Don’t change Port and anything else and just click to OK.

Site Name

Now we are almost done but need to change the “Application Pools” for this site. Click to application pools from the left panel and choose your pools as “” and double-click on that. Now you can edit your “Application Pool” for this website. From this window, you have to changes “.Net Framework version” or “.Net CLR version” with “No Managed Code” and OK.

Application Pools


The last thing, what you need to do, just make one entry about your application inside the host file, which is located on the following location. You have to add one more entry as we have done for which directly point to localhost IP address.


Host File

Time has come to run the application on the browser, so open any browser and just type and press enter. Wow… you will get the following screen it means the application has successfully hosted on IIS.

Asp.Net Core 2


So, today we have learned how to host your Asp.Net Core 2.0 application on IIS.

I hope this post will help you. Please put your feedback using comment which helps me to improve myself for next post. If you have any doubts please ask your doubts or query in the comment section and If you like this post, please share it with your friends. Thanks