February 11, 2020

Deploy or Host ASP.NET Core web application in IIS

Dear folks,

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



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)
                   .UseKestrel()
                   .UseIISIntegration()
                   .UseStartup();
 Where Kestrel hosts the application and IIS will be acting as a reverse proxy.

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
    1. net stop was /y
    2. 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:

Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com