'Visual Studio Debugging is stuck at "Attaching to the web server"

When I run my Web API application I get the following window:

Attaching to the web server

It just stays like that indefinantly, until I hit cancel.

When I do hit cancel, this error message is shown:

Catastrophic Failure

I have tried rebooting, and running iisreset /restart but it does not fix it.

Any ideas what I can do to get my debugger working again?

NOTE: My Web API 2 project's Servers setting is set to Local IIS. My service is hosted by IIS and when I am not debugging, it works fine.



Solution 1:[1]

A possible fix:

Check the "Enable Just My Code" in Tools->Options->Debug

Solution 2:[2]

I just did a reset for all the settings for VS and it worked again.

Tools => Import and Export Settings => Reset All Settings

good luck!

Solution 3:[3]

I had this issue for Visual Studio 2017 and like with the previous post I had Debugging option "Enable .NET Framework source stepping" ticked. Un-ticking fixed the issue.

Solution 4:[4]

In Visual Studio 2015, go to Tools -> Options -> Debugging and deselect "Enable .NET Framework source stepping". This may relate to an issue with loading symbols, so if you want to keep the ability to debug .NET Framework source, then it may help to search the web for how to clear the symbol cache, or preload it, or set your symbol server, and so on.

Enable .NET Framework source stepping

Solution 5:[5]

In Visual Studio 2017, I just restarted my machine and ran the solution, no other windows opened not even a browser, although visual studio took a long time to open (30+ projects in a solution) the problem did not reoccur.

Solution 6:[6]

I had the same issue in VS 2017 and un-checking 'Native code' did the trick. Not sure why it was checked.

Native code debugging

Solution 7:[7]

In my case I set Debugging ->Symbols -> To "Load Only Specified Modules" to include the symbols for, in my case a devops symbols feed for some internal NuGet packages

Options>Debugging>Symbols>Load Only Specified Modules

By checking the option "Always load symbols where located next to modules" the setting won't mess with the regular/classic debugging in VS for your own code

This way the Symbols are still loading where needed and Visual Studio is not trying to load debugging information for all the IIS .net dlls that were loaded by w3wp

Alternatively it can also be configured to not load symbols for microsoft.*.dll and it will also work.

Solution 8:[8]

Didn't see this in the current answers, so thought I'd give my 2 cents in 2022:

What worked for me: Make sure to check that your IIS application pool hasn't been stopped (and restart it if it is), and then if that's not the case, restart your IIS server.

If you don't where those settings are, open our Internet Information Services (IIS) Manager, Application Pools are in the left-hand column, and restart/start/stop your server is in the right column.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kamarey
Solution 2 Mu'men Tayyem
Solution 3 user8055899
Solution 4 ErikE
Solution 5 Basil
Solution 6 Michal
Solution 7 Vogon Jeltz
Solution 8 P. Davis