Hosting a .NET Application on IIS Server

Jan 29, 2024

Hosting your .NET application on an IIS (Internet Information Services) server allows it to be accessed and consumed over the internet by users. IIS is commonly used to host .NET applications and web APIs. 

Before you can host the application, ensure you have the following: 

  • A .NET web application or API built (for example using ASP.NET Core) 

  • A Windows Server machine with IIS installed and configured 

  • Permissions to remotely access the server over a network 

 

Follow this step-by-step guide to deploy your .NET Application on the IIS Server seamlessly. 

Step 1: Open your .NET Application in Visual Studio 

Open your application or project in Visual Studio and build the application. 

 

Step 2 : Publish the Application or project. 

Now, Right-click on your project and select the publish option. 

Here, select the folder and then click on next, and finish the publish setup. 

Now, Click on the publish button to publish your code to one folder. 

After, publishing is succeeded click on the open folder. You will see your published code in this folder. 

 

Step 3: Configure IIS on the Server 

Carry out these steps to prepare IIS for hosting the application. If IIS is not installed in your system, then first install the IIS on your machine. 

  1. Open IIS Manager on the Windows Server 

  1. Right-click on the Sites folder and click Add Website 

           

      3. Provide a name for the website, Set the physical path to the app folder, and select a port where you want to host the application. 

           

      4. Click OK to create the new IIS website.

 

Step 4: Publish code to IIS Server. 

Now stop the website and open the folder that you have given in the Physical path while configuring it, by right-clicking on your website and selecting explore. 

Now, copy all the published files into your server folder. 

Once all the files are copied into the publish folder Start the website and click on Browse*: {Your port} (http) under browse website. 

you will see the output of your code on the server. 

If your project is based on MVC then Recycle Application pool is required. You can find your Application pool under the Application Pool section. Right-click on your website app pool and click on recycle.

Conclusion:

Hosting the application on IIS allows it to be reached by users from over the network and the internet. It handles request routing and security layers for serving the application.

Meet Dobariya

About the Author

Meet Dobariya

Experienced .NET developer proficient in various technologies with a passion for continuous learning. Over 2 years of hands-on experience in software development across multiple domains. Enthusiastic about technology and adept at adapting to new challenges.