DevOps – Deploy and Publish ASP.NET Core Application to Windows Server IIS

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.

When Developing application with Visual Studio or Visual Studio Code, we don’t always understand or know how to move the application from development to the real world.

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.

https://dotnet.microsoft.com/download/dotnet-core/2.2

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.

Conclusion

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.

Processing…
Success! You're on the list.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.