Iis Express Debug Mode Issue

Iis Express Debug Mode Issue

There is an issue when I debugging my backend net5.0 project. The issue is "Web server failed to listen on port 5001" then I changed port but the problem does not change.

10

5 Answers

I had the same issue after loading one of the existing project. I was able to resolve this by installing the .NET version project was targetting. (In my case, it was .NET 5).

Reason for the error: Since .NET's previous versions are out-of-support, Visual Studio won't install previous versions during installation.

Remedy: Intall SDK by yourself after installing Visual Studio

1

In my case that was

app.Run();

line deleted accidently from Program.cs

For me the issue was that i added some configuration to the appsettings.json file and i forgot to add a comma. fixing that and everything was back to work.

2

If you are using application url with port and you are using different url port in the environment variables settings in some field like origin. Then this problem arises. You have to keep them same.

1

I had a similar Issue after updating my packages, to fix it:

Make sure that the DotNet version in the csproj is the same as the version found in the following folders:

C:\Program Files\dotnet\shared\Microsoft.NETCore.App C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App

So my csproj was contained:

<ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.4" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.4" PrivateAssets="all" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="7.0.4" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.4" />
  </ItemGroup>

So I made sure that all the File locations specified above the csproj file had versions 7.0.4.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Maya Lin-Takahashi
Author

Maya Lin-Takahashi

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.