How to Deploy an ASP.NET Core Application on IIS Server

Deploying an ASP.NET Core application on IIS (Internet Information Services) is a common requirement for hosting .NET-based web applications. In this blog, I’ll walk you through the step-by-step process using screenshots to make the deployment seamless.


Step 1: Open Your Project in Visual Studio

  1. Launch Visual Studio and open your ASP.NET Core project.

  2. Right-click on the project in the Solution Explorer.

  3. Select Publish from the context menu.


Step 2: Choose Publish Options

After clicking on Publish, you will see the Publish Page where you can configure your publishing profile.


Step 3: Add a Publish Profile

  1. Click on Add a publish profile to set up a new publishing configuration.

  2. A popup window will appear, allowing you to select the publish target.


Step 4: Select Publish Target as Folder

  1. From the popup, choose Folder as the publish target.

  2. Click Next to proceed.


Step 5: Set the Deployment Location

  1. Specify the deployment location—a folder where the published files will be stored.

  2. Click Finish to complete the profile setup.


Step 6: Publish the Application

  1. After setting the deployment location, you’ll return to the Publish Page.

  2. Click the Publish button to start the deployment process.

  3. Visual Studio will build the project and copy all necessary files to the specified folder.

Select the Configuration:

  • In the Publish wizard, look for the Configuration dropdown.

  • Select the appropriate configuration (e.g., Debug or Release).

    • Debug: Ideal for local development or testing.

    • Release: Ideal for production deployment.


Step 7: Configure IIS to Host the Application

Now that the application is published, you need to configure IIS to host it:

  1. Open IIS Manager:

    • Press Win + R, type inetmgr, and hit Enter.
  2. Add a New Site:

    • Right-click on Sites and choose Add Website.

  1. Configure Site Settings:

    • Provide a Site Name, select the Physical Path (the folder where you published the application), and set the Binding (e.g., http on port 80).

  1. Click OK to save the site.

Step 8: Verify the Deployment

  1. Open a browser and navigate to the URL of your hosted site (e.g., http://localhost or your configured domain).

  2. Verify that the application is running as expected.


Conclusion

Deploying an ASP.NET Core application on IIS is straightforward with Visual Studio’s built-in publish tools. This guide covered the essential steps, from creating a publish profile to configuring IIS. With these steps, your application should be live and ready to use.

Feel free to comment below if you encounter any issues or have additional tips to share!