I attempt to lunch my ASP.NET Core project in Microsoft Visual Studio 2019 and got this error: "Unable to connect to web server 'IIS Express'"
- Visual Studio 2019 Version 16.9.5
- .Net 5.0
I attempt to lunch my ASP.NET Core project in Microsoft Visual Studio 2019 and got this error: "Unable to connect to web server 'IIS Express'"
I tried this one and it worked for me:
Go to 'Debug Properties'
Find 'Web Server Settings'
Change the port in 'App URL' section and save the changes
Run the application and the same error will appear again
Switch the port back to the original port and save the changes
Run the application and enjoy it!
I hope this trick work for you.
If rebooting fixes this for you, then do this instead:
net stop winnat
net start winnat
The problem is that something reserved your desired port and made it unavailable.
I tried this one and it worked for me:
Go to 'Debug Properties'
Find 'Web Server Settings'
Change the port in 'App URL' section and save the changes
Run the application and the same error will appear again
Switch the port back to the original port and save the changes
Run the application and enjoy it!
I hope this trick work for you.
1- Go to 'Debug Properties', Find 'Web Server Settings', Change the port in 'App URL' section and save the changes
In your project folder, delete .vs file, also remove the launch settings file in properties (make sure you copy to a different folder before removing it).
Restart visual studio and your machine if possible. Go to launch setting, check if they are properly configured similar to your prev launch settings. Run the application in IIS.
Should start working.
The following fixed the problem for me.
From my experience this issue appears when the port used is already in use by other process. You will see the following:
Error description: The process cannot access the file because it is being used by another process. (0x80070020)
Just choose a port number which is free to use and the problem will disappear!
For those how are still trying.
It might be because your application is not starting up in the first place. These due to logic errors in the Program.cs or Startup.cs.
For me it was a Service that I didn't implement to Dependency Injection.
So the Solution for me was to add the Service builder.Services.AddTransistend(...)
.
To me it has worked by switching the project from Debug to Release and Starting it. When I switch back to Debug it starts correctly. It appears to me that For some reason i had the Release project running so the Debug couldn't start.
I have just an API project. Going to project's Properties\Debug and unchecking the 'Launch browser' helped.
In my case... (Visual Studio 2019, .net 5, blazor wasm project):
Now you can redo your updates on the "Properties\launchSettings.json" (i.e. change port).
In my case it was the wrong .net6 version. I work in a project with other developers. The main developer switched the project from .net5 to .net6. He has 6.0.3 installed, I have 6.0.2. Visual Studio did not show this. On the console with dotnet run, I get this error message.
My error message was regarding Kestrel web server: Visual Studio is unable to connect to web server
... the web server is no longer running
. I had to replace applicationUrl
values from https://0.0.0.0:5001
to https://localhost:5001
. I got this error when I updated Visual Studio 2022 to 17.3.0
If you are like me and have probably tried all the above answers to no avail, here is a final solution that has helped me many times.
Answer: Do not restart your system (did this and it failed to work for me most times), rather, save all your work items, then shut down your system to allow all running process to shut down, then power on again.
If you do a restart, IIS Express may not get shut down completely, therefore, your port will still be used by the process holding on to it.
This works for me always
not sure if this answer will help anybody but I had made changes in appsettings.json file in Asp.net Core (net 6) and forgot to add coma after curly brackets
{
"AppSetting": {
"Token": "MY TOKEN"
}, ----------------------->here
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
Hence: you might find your errors in your warnings
In my case Enabling(Start-->Services-->WWW Pub.service) the WorldWideWeb Publishing Services resolves the issue of contacting remote server debugger
Well for me nothing worked of the above, and I tested everything. At the end what worked was a simple restart of the computer.
Environment:
For me Clean Solution and Rebild Solution fixed the problem.
In my case, I forgot to create the Hangfire Database.
I had this problem, but I created it myself. I modified the app.Run(); by adding a bit of code in the middle of this method. The solution was simple, it was necessary to have a clean app method at the end app.Run();
© 2022 - 2025 — McMap. All rights reserved.