How To Deploy ASP.NET Core 5.0 Application In Windows Server IIS

Introduction

 
Many banks, corporations, and enterprise businesses still prefer using Windows Server. Besides this, those organizations choose server-based applications for their businesses. This article will describe a method with necessary steps to deploy ASP.NET Core Application in Windows Server IIS from scratch. In this article, we will learn to create an application in ASP.NET Core, publish it and deploy it in Server IIS. Additionally, it will explain prerequisites for the server to support ASP.NET core application and configuration of Server IIS for .NET Core solution. Besides this, it will briefly describe application pool.
 

Create and Publish Project

 
Create Project
 
Open Visual Studio and click on Create Project.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Select ASP.NET Core Application and click Next.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Give Project Name, select location of the project. By default, Project Name comes as Solution Name; however, you can change it according to your wish. Then Click on Create.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Select Framework .NET Core and ASP.NET Core 5.0 as illustrated below.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Project will be created and you can see all the folder structure of the project. Go to Views>Home>Index.cshtml. Then, in paragraph write: “ASP.NET Core 5.0 Framework Demo deployment in Windows Server IIS”.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
After that, build project and check it by running in the browser. The below image represents our Demo application.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Publish
 
Now, it’s time for publishing the solution. Right click on Project and click on Publish.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Select Folder and click on Next as illustrated below.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Browse the location where you want to publish this solution and click on Finish.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Subsequently, you will get the option to Publish as shown below. Click on Publish to finish the publish process.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Wait for a few minutes to get the published solution. 
 
Now, at this stage the application is ready to deploy in the Server. Go to folder location, copy all published files and move it to the Server where you want to deploy the application.
 

Server Configuration and Deployment

 
Server Prerequisites
 
Firstly, we need to install prerequisites to host ASP.NET Core App in Server IIS. Install .NET Core Hosting Bundle Installer in your Server where you are going to deploy the solution. For more information and details please visit Current .NET Core Hosting Bundle installer.
 
Before getting started with server configuration. We need to know about application pool.
 
What is Application Pool?
 
Application pool allows us to define a set of one or more worker processes with configuration of similar settings so that server can request to one or more applications that are assigned to those application pools. It allows a group of web applications to share one or more commonly configured worker processes which facilitates a path to isolate a group of applications on the server computer. It separates each worker process which means that if there is any issue in one application pool, it does not affect the other application. We can use the existing or default application pool provided by IIS as well as create our own application pool. In this article, I will demonstrate how to create our own application pool and deploy the application using that own application pool.
 
For more details Visit: Application pool
 
Follow below steps for Configuration and Deployment of application.
 

Steps

 
After installation of .NET Core Hosting Bundle. Open IIS in your server, go to Application Pool and right click and click on Add Application Pool.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Give the application Pool Name: ASP.Net Core Pool, .NET CLR version: to No Managed Code Manage, pipeline mode: to Integrated, then click on OK.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Go to sites, right-click on it, and click on Add Website.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
After that, the following screen will pop up. Fill out the site name and click on Select for Application Pool value selection.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Clicking on Select will bring you to another screen to select the Application pool. Select ASP.Net Core Pool in Application Pool value and click OK.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
Choose a Physical Path as depicted below, provide the port number and then click on OK.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Website testdemo is added to IIS.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Right Click on Testdemo and click on Explore. It will open the physical location of the site.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Go to the physical path/location and copy-paste all of your ASP.NET Core application's published files there. After copying the published file, Restart IIS.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Now, open the application in the browser by clicking on Browse, as shown below.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 
Finally, while browsing the application will look like as depicted below.
 
How to Deploy ASP.NET Core 5.0 Application in Windows Server IIS
 

Conclusion

 
This article has described all the necessary steps to deploy APS.NET Core application in Windows Server IIS from scratch. In this article, we have learned how to create ASP.NET Core application with .Net Core 5.0 Framework, published it and eventually configured Server for ASP.NET Core Application deployment and deployed the application in Windows Server IIS. I hope, this will help you to deploy ASP.NET Core application in Windows Server IIS.