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
For any reason, if you need previous version of .Net core, you can download the installer from the below link.
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.
The Windows Server hosting setup dialog will appear. Just agree on the license and click install button.
You will see the installation progress, and it normally take less than a minute to complete the installation.
Once the installation succeeded, you will see the success message.
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.
Now login to the server and login to IIS Manager. In the IIS Manager right click sites, and choose Add Website
Enter the application details and click the OK button.
Now go to the application pool, and make sure you select “No Managed Code” in the .Net CLR version.
Now copy the files to the folder and browse the website url, you will see the default website.
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.