"Knowledge has to be improved, challenged, and increased constantly, or it vanishes."

Deploy ASP.Net core 2.2 under IIS

The ASP.Net core is getting popular day by day. Developers are busy migrating the applications to ASP.Net core. With the Visual Studio tooling support, it is easy to develop applications in ASP.Net core. Once the application is developed, most of those applications needs to be hosted under IIS, in this article I am doing a walkthrough of installation and configuration of ASP.Net core in IIS. For the purpose of this walkthrough, I used a Windows 2016 with couple of ASP.Net based applications are already configured under IIS, now I am going to configure ASP.Net core without affecting the other applications.

First thing, you need to download the installer package for the .Net core, the following link always gives you the current release version of the .Net core, while I am writing this article, the current version is 2.2

https://www.microsoft.com/net/permalink/dotnetcore-current-windows-runtime-bundle-installer

clip_image002

For any reason, if you need previous version of .Net core, you can download the installer from the below link.

https://dotnet.microsoft.com/download/archives

clip_image004

Once you download the installer, double click on it to start the installation. The regular security warning will appear, click the Run button to start the installation wizard.

clip_image005

The Windows Server hosting setup dialog will appear. Just agree on the license and click install button.

clip_image006

You will see the installation progress, and it normally take less than a minute to complete the installation.

clip_image007

Once the installation succeeded, you will see the success message.

clip_image008

Configure Website

Now in order to test my installation, I created a ASP.Net Core 2.2 application. Basically the default application without any customization. I published the application to a folder so that I can deploy the application to the IIS. The following is the published folder of my application.

clip_image010

Now login to the server and login to IIS Manager. In the IIS Manager right click sites, and choose Add Website

clip_image011

Enter the application details and click the OK button.

clip_image012

Now go to the application pool, and make sure you select “No Managed Code” in the .Net CLR version.

clip_image013

Now copy the files to the folder and browse the website url, you will see the default website.

clip_image015

Notes:-

I have noticed the application pool settings is working with .Net CLR version selected to 4.0.

In one of the server, I got 500 error stating failed to load the ASPNETCORE.DLL, you need to ensure you install Microsoft Visual C++ 2015 Redistributable before install .Net core hosting bundle.

2 Comments

  • Excellent article. I was trying this for past few days and this article saved me.

  • Yes, great article. I have tried to publish .net core on asphostportal hosting. Before find your tutorial above, I receive an error message and I finally found the problem, the application pool need to be set to "No Managed Code".

    Thank you

Add a Comment

As it will appear on the website

Not displayed

Your website