Sunday, 18 January 2026

Fix: IIS localhost:2996 error in ASP.NET MVC (.NET Framework 4.8)

Fix IIS localhost:2996 Error in ASP.NET MVC (.NET Framework 4.8)

If you encounter the below error while running an ASP.NET MVC application in Visual Studio:

The Web Application Project is configured to use IIS. The Web server 'http://localhost:2996/' could not be found.

This issue commonly occurs due to legacy IIS settings stored inside the .csproj file.


Environment

  • Visual Studio 2022
  • ASP.NET MVC
  • .NET Framework 4.8
  • IIS Express

Root Cause

Even though IIS Express is enabled, the project may still be forced to use Local IIS due to legacy configuration stored inside <ProjectExtensions> in the .csproj file.

The following settings hard-lock the project to port 2996:

<UseIIS>True</UseIIS>
<DevelopmentServerPort>2996</DevelopmentServerPort>
<IISUrl>http://localhost:2996/</IISUrl>
<IISAppRootUrl>https://localhost:2996/</IISAppRootUrl>

Step-by-Step Solution

Step 1: Change IIS Express SSL Port

<IISExpressSSLPort>44321</IISExpressSSLPort>

Step 2: Close Visual Studio

Completely close Visual Studio before proceeding.

Step 3: Delete Cached Folders

.vs
bin
obj

Step 4: Reset IIS Express Configuration

C:\Users\<username>\Documents\IISExpress\config\applicationhost.config

Step 5: Fix the .csproj (Critical Step)

Change:

<UseIIS>True</UseIIS>

To:

<UseIIS>False</UseIIS>

Delete the following entries completely:

<DevelopmentServerPort>2996</DevelopmentServerPort>
<IISUrl>http://localhost:2996/</IISUrl>
<IISAppRootUrl>https://localhost:2996/</IISAppRootUrl>
<OverrideIISAppRootUrl>True</OverrideIISAppRootUrl>

Step 6: Delete User Override File

DPTextiles.csproj.user

Step 7: Reopen and Run

  • Open the solution
  • Set project as Startup Project
  • Press F5

Expected Result

The application should now run successfully using IIS Express:

https://localhost:44321/

Key Learnings

  • <UseIIS> has higher priority than <UseIISExpress>
  • ProjectExtensions can silently override Web settings
  • .csproj.user can break IIS configuration

Best Practices

  • Use IIS Express for local development
  • Avoid hard-coding Local IIS URLs
  • Keep solution name and project name different

Author: Arulkumar Sivaraj

Blog: arulkumarsivaraj.blogspot.com