Deploying .NET Core 6.0 Web API on IIS: A quick Guide

IIS or Internet Information Server is the server used to host .Net web applications

For users to access a website, it is required that the website is hosted on some sort of web server. There are different web servers available for different technologies. In .NET, the web server available is called Internet Information Services or IIS

Here is a step-by-step explanation of hosting Web API in IIS server along with an example.

Install IIS server

Go to the control panel -> Program and Features

->turn Windows features on and off

Select the all features in Internet Information Service and .Net framework 4.8 advanced services

It will install IIS in your Machine

Download the Hosting bundle using below link:

https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-6.0.7-windows-hosting-bundle-installer

Open IIS

Create a new site.
Site->Add Website

Fill the fields as given below.

It will create the new site.

Go to Application pools->Basic settings

Change the version to No Managed Code

Click your site and browse it.

It will run like following.

Run visual studio as Administrator

Open your Own Project

Right click (your project name) -> select Publish->Web Server (IIS)

Fill the details

Server – localhost

Site name – (your site name)  

Destination URL – (your destination file path)


Click finish then close

Click publish.

Then,

Go to IIS manager, click browse.

Add port number / (your controller name)

Here give the default controller Weatherforecast.

It will run successfully.

Note:  If your project is connected with database, then

Go to Application pool->Advanced settings->process model->Identity->Built-in-account.

Select LocalSystem.

Don’t forget to add connection string in web.config file.

Related Blogs

Elevate ASP.NET Core Web API speed with caching. Explore in-memory, distributed, and