Introduction
Still several banks, corporate companies, enterprise businesses prefer to use Windows Server. Besides this, those organizations choose server-based application for their businesses due to various reasons. 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 application in ASP.NET Core, publish it and deploy it in Server IIS. Additionally, it will explain prerequisites for Server to support ASP.NET core application and configuration of Server IIS for .NET Core solution. Besides this, it will describe application pool in short.
- Project Create and Publish
1.1 Project Create: 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. Below image represents our Demo application.
1.2. Publish: Now, it’s time for publish 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 option to Publish as shown below. Click on Publish to finish the publish process.
Wait for few minutes to get published the solution.
Now, at this stage application is ready to deploy in Server. Copy all published files and move it to the Server where you want to deploy the application.
2. 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 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 pool. It allows a group of web applications to share one or more commonly configured worker processes which facilitates path to isolate a group of applications on the server computer. It separates each worker process which result into that if there is any issue in one application pool, it does not affect the other application. We can use existing or default application pool provided by IIS as well as create our own application pool. In this article, I will demonstrate to create 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.
Give application Pool Name: as ASP.Net Core Pool , .NET CLR version: to No Managed Code Manage, pipeline mode: to Integrated and then click on OK.
Go to sites right click on it and click on Add Website.
After that following screen will be popup. Fill out site name, Click on Select for Application Pool value selection.
Clicking on Select will bring you to another screen to select Application pool. Select ASP.Net Core Pool in Application Pool value and click OK.
Choose Physical Path as depicted below, provide 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 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 browser by clicking on Browse as shown below.
Finally, while browsing the application will look like as depicted below.
Conclusion
Therefore, 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 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.