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
Launch Visual Studio and open your ASP.NET Core project.
Right-click on the project in the Solution Explorer.
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
Click on Add a publish profile to set up a new publishing configuration.
A popup window will appear, allowing you to select the publish target.
Step 4: Select Publish Target as Folder
From the popup, choose Folder as the publish target.
Click Next to proceed.
Step 5: Set the Deployment Location
Specify the deployment location—a folder where the published files will be stored.
Click Finish to complete the profile setup.
Step 6: Publish the Application
After setting the deployment location, you’ll return to the Publish Page.
Click the Publish button to start the deployment process.
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:
Open IIS Manager:
- Press
Win + R
, typeinetmgr
, and hit Enter.
- Press
Add a New Site:
- Right-click on Sites and choose Add Website.
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).
- Click OK to save the site.
Step 8: Verify the Deployment
Open a browser and navigate to the URL of your hosted site (e.g.,
http://localhost
or your configured domain).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!