When trying to debug a ASP.NET MVC app, the breakpoints in my controllers arent getting hit. When entering debug mode they just show an empty red circle with a warning trian
Things to try:
Clean the Solution, then rebuild it.
If that doesn't work, close the solution, delete the bin
and obj
folders, and rebuild.
w3wp.exe
). Some team member deleted the Debug configuration for one project (The MVC Project). Though the Solution configuration was set to "Debug / AnyCPU", if you looked in the configuration for that, the Project-Configuration for the MVC Project was set to Release, with no option for Debug, and all other projects were set as Debug appropriately.
So I added Debug back to the project configurations (Just drop-down "Add"... uncheck the box to add to solution). And viola...
I had a similar problem with a simple Web API project in Visual Studio 2015. I solved the problem, after reading that the easy fix was to set the Startup Project to the correct project. Since I had another Web API project in the same solution, I guessed that the project I was debugging was mixing up which index.html to debug, so I renamed that current one to index2.html. Then setting the Project properties Web tab to Specific Page and the page text: "index2.html" solved the problem.
It might be helpful to:
None of these answers helped me. Some of my breakpoints were hit, and some not. But I discovered the problem in my case.
If there is a file at the exact same virtual location with the exact same name as the URL you are trying to debug, the file will be served to the browser automatically by IIS and the breakpoint will not be hit because no MVC code actually runs.
I have read and implemented all the suggestions above, to no avail.
What worked for me is, i simply changed the controller action i was trying to break into to [HttpPost].
My issue was that i was trying to debug a method decorated with a [HttpGet] attribute routing to a different view and instead of hitting my break point, it keeps routing and displaying the return view.
Hope this helps someone!
Happy coding.