Microsoft IIS Local Development Guide

Enable IIS on Windows to host ASP.NET and static websites via http://localhost.


Internet Information Services (IIS) is a built-in web server for Windows, commonly used to host ASP.NET, .NET Core, and static sites. During local development of .NET web applications, access is frequently done through http://localhost.

Default localhost Access

PurposeAddress
Default Sitehttp://localhost
Specified Port Sitehttp://localhost:8080

The default site is typically bound to port 80.

Enabling IIS

  1. Open “Control Panel → Programs → Turn Windows features on or off”.
  2. Check Internet Information Services and the required sub-items (ASP.NET, Web Management Tools, etc.).
  3. Confirm and restart (if prompted).

Alternatively, use PowerShell (as Administrator):

Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole

Website Directory

Default physical path: C:\inetpub\wwwroot\

In IIS Manager, you can add new sites, bind ports, and configure application pools. Visual Studio will automatically configure local IIS Express (commonly http://localhost:random_port) when publishing or debugging with F5.

IIS Express

IIS Express is used during Visual Studio development, with addresses like http://localhost:44300/, operating independently from full IIS, making it suitable for daily debugging.

Common Issues

403 Forbidden
Check folder permissions and IIS user (IUSR, IIS_IUSRS) read permissions.

500 Internal Server Error
Check the Event Viewer and web.config; ASP.NET Core requires the Hosting Bundle to be installed.

Port 80 Occupied
Change to port 8080 or another port in the site bindings.

Summary

IIS or IIS Express is commonly used for .NET and ASP development on Windows, with local access via http://localhost or the localhost port assigned by Visual Studio.

访客计数:------ Best viewed in Netscape Navigator · 800×600 © LocalHost Run