问题
I can't get a breakpoint in a Razor view to be hit in Visual Studio 2013 while debugging in IIS Express.
This is the view and unreachable breakpoint:

Looking at the modules I see that the latest PDB file has been loaded:

And the folder
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\53ff8402\967c7053\assembly\dl3\f3c59a34\6698ffde_b452cf01
has the latest version of the DLL and PDF files:
ITVizion.VizionLogs.WeeklyLogs.Web.DLL
ITVizion.VizionLogs.WeeklyLogs.Web.PDB
I have already cleaned the solution, wiped the project's bin
folder, restarted Visual Studio, etc but it still won't hit the breakpoint.
What else can I try?
回答1:
Can't believe it guys... wasted almost 1 hour on this. I was trying to debug the wrong view in the wrong path.
I set a breakpoint in this view:
C:\ITVizion\VizionLogs\ITVizion.VizionLogs.WeeklyLogs.Web\Views\Error\ServerError.cshtml
but actually I was trying to debug this view:
C:\ITVizion\VizionLogs\ITVizion.VizionLogs.WeeklyLogs.Web\Views\Shared\Error.cshtml
After I placed a breakpoint in the correct view, although it showed the message about the breakpoint would not be hit, the Debugger
actually hit the breakpoint during runtime! :D
来源:https://stackoverflow.com/questions/22924809/breakpoint-in-asp-net-mvc-razor-view-will-not-be-hit-no-symbols-have-been-loade