ASP.NET MVC5/IIS Express unable to debug - Code Not Running

105,710

Solution 1

The solution to the above problem was a simple one. Close down dev environments, go to Documents folder and rename IISExpress. Now set environment variable _CSRUN_DISABLE_WORKAROUNDS ( ref: http://gauravmantri.com/2013/02/05/workaround-for-iis-express-crashing-when-running-windows-azure-cloud-service-web-role-with-multiple-instances-in-windows-azure-sdk-1-8-compute-emulator/ ).

Now reboot PC, start VS, load website and run in debug. IIS automatically regenerated the IISExpress folder and the environment variable resolved conflicts.

Solution 2

For me the solution was a much simpler one. In my Solution Explorer in Visual Studio, I right click on the web project, chose properties and then navigated to the "web" tab. From there I changed the Project URL to another port number. For example, if it was http://localhost:1052 - I changed it to http://localhost:4356.

Process with an Id of xxx is not running.

Not sure if this helps anyone else, but it worked for me - hopefully it will work for you too!

Solution 3

I had the same problem and my solution was the following:

Instead of deleting the main applicationhost.config (in your "Documents/IIS Express" folder), check your solution folder for a hidden ".vs" folder with a "config" sub-folder. If that folder exists and it has it's own applicationhost.config file you need to either rename (or delete) that file or edit it and make sure the website(s) configured inside match the ASP.NET web app(s) in your solution that you are trying to debug. Hope this helps.

Solution 4

I had a similar problem while moving from Visual Studio 2013 to Visual Studio 2015 on a MVC project.

Deleting the whole .vs solution worked as a charm as Johan J v Rensburg pointed out.

Solution 5

The following steps fix the problem for VS 2015 and VS 2017:


Close VS.

Navigate to the folder of the solution and delete the hidden .vs folder.

open VS.

Hit F5 and IIS Express should load as normal, allowing you to debug.

Share:
105,710
Graeme
Author by

Graeme

Updated on December 11, 2020

Comments

  • Graeme
    Graeme over 3 years

    I start a VS2013 VB.Net MVC5 Web Application, set a breakpoint in HomeController About method and run "Start Debugging", navigate to About page and receive the message "Code not running - The current Thread is not currently running or the call stack could not be obtained" preventing any debugging.

    If I set a breakpoint in Global.asax Application_Start, the breakpoint works fine. Changing the "Enable Edit & Continue" makes no difference.

    Anyone have any ideas what is happening?

    Update: My environment was Windows 8.0 Pro with VS2013 Ultimate.

    I have since flushed my system and done a completely fresh install of Windows 8.1 Pro, VS2010 Ultimate, VS2012 Ultimate, & VS2013 Ultimate.

    Same test done on all 3 versions of VS - File > New Project > MVC (Default). All 3 versions of VS are reporting "Process with an Id of xxx is not running."

    VS2013 debug trace reports "The program '[7720] iisexpress.exe: Program Trace' has exited with code 0 (0x0). The program '[xxxx] iisexpress.exe' has exited with code -1073741816 (0xc0000008) 'An invalid handle was specified'."

    I have run VS in and out of Administrator mode and receive the same results. I have uninstalled and reinstalled IIS Express 8.0.

  • solidau
    solidau over 10 years
    They patched it. I just downloaded/installed the patch and VS is back to working order.
  • Iman Mahmoudinasab
    Iman Mahmoudinasab over 10 years
    @Juventus18 Would you please give the patch download page url?
  • solidau
    solidau over 10 years
    @iman I didn't download it from the web, I used Telerik Control Panel. My current version is 2013.3.1114
  • eka808
    eka808 about 10 years
    Same fix for me... just removed justmoq
  • jmichas
    jmichas over 9 years
    I didnt uninstall it I just disabled the JustMock Profiler and now it works. What an enormous waste of my time. Thanks for posting
  • Den
    Den over 9 years
    IIS is one of the worst parts of web development.
  • Nigrimmist
    Nigrimmist almost 9 years
    Yeap, in my case it was firefox. Try close it and re-run application. Or use command line (CMD) with command "netstat -b -a" to see what application use your port.
  • AVK
    AVK over 7 years
    This is the only solution that worked for me. Thanks a bunch.
  • Johan J v Rensburg
    Johan J v Rensburg over 7 years
    I just deleted the whole .vs folder and the problem was resolved.
  • Bruno Bieri
    Bruno Bieri about 7 years
    Perfect! Do you know the exact reason for this behavior?
  • Oliver
    Oliver over 6 years
    This was exactly what caused my issue. I had .NET Core SDK 1.1.0 and .NET Core SDK 2.0 installed. Removing the old one fixed the issue!
  • Iman
    Iman over 6 years
    you can rename it if you think you will lose something and then after closing and reopening solution is will be recreated and issue is fixed
  • Charles Byrne
    Charles Byrne over 5 years
    One of our developers encountered the same problem, but the rest of the team did not. We all had upgraded from Windows 7 OS to Windows 10. The developer with the issue had been testing ASP.net Core when it first came out with Windows 7. When he did a clean install of Win 10 (Without ASP.net Core) he encountered problems because his Projects were on his D Drive and the applicationhost.config was still referenced. Deleting the applicationhost.config (Created circa Win 7) fixed it.
  • FrenkyB
    FrenkyB over 4 years
    For me, that was the issue. I've stored the link in my browser with wrong port number, so normally debugger could not run there.