In this blog post, I will show you how I deploy and publish an ASP.NET Core web application to my Windows Server 2016 IIS 10 Server.
In this post, I will break down this process to there simple steps you can follow.
Install .NET Core Runtime and Hosting Bundle
The first step in this process will be preparing my Windows Server 2016 IIS 10 to host and run .NET Core applications.
In my case, my application is running on ASP.NET Core 2.2.
To run I need to install the ASP.NET Core Runtime and Hosting bundle on the server.
Using the download link below, I will download the bundle and install it on my Server.
Below you can see the installation screen, and it is recommended to restart IIS after the installation is completed.
Publish .NET Core Application
After the server preparation, I will move to the application preparation.
From Visual Studio 2019 or 2017 I right click on my application and click on Publish…
From the Pick a publish target screen I select Folder as the target and click browse to select a folder.
Note that this is the runtime files of the application I will copy to the server.
Below, you can see all the Published files that bellowing to my application.
You can notice that they are the runtime files only.
Configure IIS 10
The final step will be to copy the Published files to the server and add a new IIS site.
I have copied the files into a folder inside the c:\intpub\wwwroot folder on the server and now from the IIS console will add a new Website.
After copying the file, I open the IIS 10 Console and click on sites, Right click and click on Add Website…
From the Add Website screen click I name my app and select the folder I copied the files to (Physical path).
I Click OK to finish and set the binding settings.
Below, you can see my published application.
Publishing ASP.NET Core application to IIS is not a hard task however it requires understanding all the moving parts that make it happen.
The first step in needed only once and the second two steps are the ones you will not follow for each new application.