net-core
  1. net-core-hosting-to-iis

Hosting to IIS - (ASP.NET Core Deployment & Hosting)

ASP.NET Core is a powerful framework for building web applications. Once you have built your application, the final step is to deploy it to a web server. In this tutorial, we will learn how to host an ASP.NET Core application in IIS.

Prerequisites

Before we begin, make sure you have the following:

  • An ASP.NET Core application (built and compiled).
  • IIS installed and configured on a Windows server.
  • .NET Core Hosting Bundle installed on the server.

Step 1: Publish the Application

Before we can host an ASP.NET Core application in IIS, we need to publish it. You can publish your application using Visual Studio or the dotnet CLI.

dotnet publish -c Release -o <publish-folder>

This will compile and publish your application to the specified folder.

Step 2: Create a New Site in IIS

Open IIS, and create a new site by right-clicking on the Sites node and selecting "Add Website".

Create a new site in IIS

Enter the site name, physical path (the path to the wwwroot folder of your published application), and host name.

Configure the site settings

Click "OK" to create the site.

Step 3: Install .NET Core Hosting Bundle

You need to install the .NET Core Hosting Bundle on the server before you can host an ASP.NET Core application in IIS.

Download the .NET Core Hosting Bundle from Microsoft's website.

Step 4: Configure the Application Pool

Once the installation is complete, open IIS and select the application pool for your site. By default, IIS will create a new application pool for the site.

Select the application pool

Make sure the "No Managed Code" option is selected.

Step 5: Configure the Site to Use the Application Pool

In IIS, select the site you created earlier and click on "Basic Settings".

Configure basic settings

Select the application pool you created in the previous step and click "OK" to save the settings.

Step 6: Test the Site

Now that everything is set up, you can test the site by navigating to the host name that you specified earlier.

If everything is set up correctly, you should see your ASP.NET Core application running in IIS.

Conclusion

By following these steps, you should now be able to host an ASP.NET Core application in IIS. Remember to publish your application before you can host it and install the .NET Core Hosting Bundle on the server. This will help you to deploy and host your application on a web server for the world to see.

Published on: