How To Host ASP.NET Core Application on IIS Server

Prerequisites

  • Installed DotNetCore.1.0.4_1.1.1-WindowsHosting.exe
  • Installed dotnet-dev-win-x64.1.0.0-preview2-1-003177.exe (for 64-bit system) or dotnet-dev-win-x86.1.0.0-preview2-1-003177.exe (for 32-bit system).
  • Turn Windows Features On

    1. Open Control Panel.
    2. Click on "Programs and features".
    3. Click on "Turn On or Off Windows Features".
    4. Check if the below-highlighted folders are checked. If not, make them checked and apply changes.

      Asp.Net Core Application

  • Create an Empty Folder

    1. Open C drive.
    2. Open the inetpub folder.
    3. Open the wwwroot folder.
    4. Create an empty folder in it with the folder name respective to your solution name.
      Asp.Net Core Application
                           
      Asp.Net Core Application
                              
      ASP.NET Core

STEP 1

  • Open Visual Studio in Administrator mode.
  • Right-click on Visual Studio and you will see an option of "Run as administrator". Just click on it.

    Asp.Net Core

  • Open your ASP.NET Core solution.

    Asp.Net Core

  • Right-click your WebApp project.
  • You will see an option to "Publish". Click on it.

    Asp.Net Core

  • This pop-up window will appear.

    Asp.Net Core

  • Select a Custom Profile.

    Asp.Net Core

  • Create a Publish profile giving the profile name according to your application.

    Asp.Net Core

  • Click "Next".
  • Change Publish method to "File System".
  • Change Target location to the empty folder path you created.

    Asp.Net Core

  • Click "Next".
  • Change the Target Runtime based on the Operating System you want to host the app upon.

    Asp.Net Core

    Asp.Net Core

  • Click "Next".
  • Check the preview and publish.

    Asp.Net Core

  • It will start publishing and you will get a message.

    Asp.Net Core

STEP 2

  • Open IIS Manager.
  • You will find a default website there.
  • Refresh it and you will see the Project_Name folder.

    Asp.Net Core

  • Right-click the Project_Name folder.
  • You will see an option of "Convert to Application".

    Asp.Net Core

  • Again, right-click on Project_Name folder and hover over "Manage Application".

  • Asp.Net Core

  • Click on "Browse" and your application gets hosted with localhost/Project_Name.
  • To access the website on other system's browser, you need to run it with IPAddress/Project_Name. (Example: http://10.17.1.191/Sample)

Next Recommended Readings