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

匿名 (未验证) 提交于 2019-12-03 02:42:02

问题:

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.

回答1:

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.

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



回答2:

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.



回答3:

If you are using 64 bit machine

Go to Visual Studio > Tools Menu > Options



回答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.



回答5:

Well.. for me it was Telerik JustMock Q3 2013 (13.3.1015.0) that caused the problem. Uninstalled it from VS 2013 and the problem has gone..

see also ASP.NET-MVC4 Code Not Running and http://feedback.telerik.com/Project/105/Feedback/Details/63749-unable-to-debug-asp-net-projects-with-q3-2013

One lost day and many new white hairs... Curse on you Telerik guys! ;)



回答6:

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.



回答7:

Another scenario may be that the port that IIS is using for your application is already being used by another running application. Try changing the port and see if it works for you.



回答8:

I started to get this problem with Asp.Net Core Web Applications in Visual Studio 2017. It didn't matter if it was the .Net Core Standard version with .Net 4.5.2 or the Core version with 1.1 in my case. IISExpress crashed when I started debug.

Tried everything, nothing worked until I went into add/remove programs in Windows 10 and I uninstalled .net core 1.0 runtime (I had both 1.0 installed AND 1.1). Once that was uninstalled, I started Visual Studio 2017 and my .Net Core Web applications (both kinds) and they both started working again!



回答9:

The similar problem occurs in aspdotnet core with the same error The program '[xxxx] iisexpress.exe' has exited with code -1073741816 (0xc0000008).

Log file setup in web.config did not produce any info also:

To find exact error the next step with log info in command prompt helped:

> dotnet restore > dotnet run 

In my case the problem was in dotnet core v 1.0.0 installed, while version 1.0.1 was required to be globally installed.



回答10:

I have solved this issue for me. Try to change all Deny values to Allow in file %SYSTEM_DRIVE%\Program Files\IIS Express\AppServer\applicationhost.xml. Please, take into account what IIS Express Web Server you are using in Visual Studio Settings, 32 bit or 64 bit, that means I have to check the file in different folders. Then restart Visual Studio. I don't know about security issues for those config lines, so change them at your own risk, but it has solved my problem.

etc.



回答11:

Delete File C:\Users\congt\Documents\IISExpress



回答12:

None of the above answers worked for me but I finally found what my issue was. Hopefully this will help someone down the line.

First run IIS Express from command prompt to validate that the site can or cannot be run

https://docs.microsoft.com/en-us/iis/extensions/using-iis-express/running-iis-express-from-the-command-line

Im my case, i got an error saying that C:\Windows\Microsoft.NET\Framework64\v4.0.30319\CONFIG\web.config had malformed xml on line 14. Looking at that line in the file it just said null null null null null etc.

The fix for me was to replace the web.config file with one from my coworkers. IMPORTANT you must get the file from someone running the same version ie if you are VS2015 get a copy from someone running VS2015. If you get it from someone running a different version you will see an error saying it could not load an assembly from the manifest.

Hopefully this helps someone that has tried all the suggestions above. I think the cause of this for me was updating from trial mode and adding a product key within VS2017



回答13:

The following steps fix the problem for Visual Studio 2015 and Visual Studio 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.



回答14:

Go to project directory .vs/config/ and remove applicationhost.config . Then restart project.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!