Introduction
Basically, Internet Information Service (IIS) is the flexible and general-purpose web server provided by Microsoft that will be run on Windows and used to serve requested files.
Required Tools
- IIS Manager
- .NET Core SDK 6
- Visual Studio 2022
Let’s start
Step 1. Create a new .NET Core Web API Project.

Step 2. Configure your new project.

Step 3. Provide additional information like .NET Framework Version, Open API, and HTTPS

Step 4. Project Structure

Step 5. Create the Product Controller and add one endpoint inside that class and also check other files that are created by default
using Microsoft.AspNetCore.Mvc;
namespace WebAPI.Controllers {
[Route("api/[controller]")]
[ApiController]
public class ProductsController: ControllerBase {
[HttpGet]
[Route("list")]
public IDictionary < int, string > Get() {
IDictionary < int, string > list = new Dictionary < int, string > ();
list.Add(1, "IPhone");
list.Add(2, "Laptop");
list.Add(3, "Samsung TV");
return list;
}
}
}
Program.cs file
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment() || app.Environment.IsProduction()) {
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
Here also, you can see we configure the HTTP request pipeline for both Development and Production Environment.
WebAPI.csproj file
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>
</Project>
launchSetting.json file













Ying LamPosted Oct 26, 2023, 11:05 AM
Well explained. thanks
Hamid KhanPosted Jan 25, 2023, 6:49 PM
Good Explanation.........
Mayooran NavamanyPosted Aug 31, 2022, 6:42 AM
Nice Explain
Hamid KhanPosted Jul 7, 2022, 10:15 PM
Well Explain Jaydeep Patil