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.
Open Visual Studio and click on Create Project.
Select ASP.NET Core Application and click Next.
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.
Select Framework .NET Core and ASP.NET Core 5.0 as illustrated below.
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”.
After that, build project and check it by running in the browser. The below image represents our Demo application.
Publish
Now, it’s time for publishing the solution. Right click on Project and click on Publish.
Select Folder and click on Next as illustrated below.
Browse the location where you want to publish this solution and click on Finish.
Subsequently, you will get the option to Publish as shown below. Click on Publish to finish the publish process.
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.
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.
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.
Go to sites, right-click on it, and click on Add Website.
After that, the following screen will pop up. Fill out the site name and click on Select for Application Pool value selection.
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.
Choose a Physical Path as depicted below, provide the port number and then click on OK.
Website testdemo is added to IIS.
Right Click on Testdemo and click on Explore. It will open the physical location of the site.
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.
Now, open the application in the browser by clicking on Browse, as shown below.
Finally, while browsing the application will look like as depicted below.
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.