Today I am going to explain the process of deploying the ASP.NET Core web application in IIS (Internet Information Services) web server.
Pre-requsites
- ASP.NET Core Runtime Hosting Bundle
- Navigate to https://dotnet.microsoft.com/download/dotnet-core/current/runtime
- Download Hosting Bundle to deploy [ASP].NET Core applications on a server
Application configuration
To make sure the application deploys and works with IIS, you should add the following while creating the web host.WebHost.CreateDefaultBuilder(args)Where Kestrel hosts the application and IIS will be acting as a reverse proxy.
.UseKestrel()
.UseIISIntegration()
.UseStartup();
Publish the application
After doing the changes, publish the application to a folder as self-contained as you no need to bother about the server for all the application dependencies.Web Configuration
- In Web.config, remove the following content
- hosting="In Progress"
- Copy files to IIS location
- Create a website folder in IIS wwwroot folder
- Copy the publish folder to the website folder
- Example: C:\inetpub\wwwroot\website
IIS Application Pool
- Create an application pool in IIS with following configuration
- Name:
- .NET CLR version: No Managed Code
- Managed pipeline mode: Integrated
Website Configuration
- Right click on the website and select "Add Application"
- Give the following details
- Alias:
- Application Pool: Select above created application pool from list
- Physical path: Select the above created website path
- Example: C:\inetpub\wwwroot\website
Restart IIS
- Once you have completed all the steps, perform the following to make sure everything is in sync.
- Open powershell in administrator mode
- Run the following commands
- net stop was /y
- net start w3svc
Test
Browse to the URL, you should be able to get the web pages.
Please send your valuable feedback and comments to psrdotcom@gmail.com
No comments:
Post a Comment