MVC 视图中的错误调试:无法设置以下断点

Error debugging in a MVC View: The following breakpoint cannot be set

没有实际的代码示例可以显示,因为无论您将断点放在哪里,它都会发生。

使用 Visual Studio 2013(我们从 2012 年迁移了这个项目),在任何 .cshtml 视图中设置断点时出现此错误:

The following breakpoint cannot be set

我尝试了各种方法,例如清理我的解决方案、关闭和打开 VS2013 等。似乎没有任何效果。

我该怎么办?

我们在站点的根目录中找到了这个节点 Web.config:

<compilation debug="true" targetFramework="4.5" assemblyPostProcessorType="Microsoft.VisualStudio.Enterprise.Common.AspPerformanceInstrumenter, Microsoft.VisualStudio.Enterprise.AspNetHelper, Version=12.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx"/>

瞧,删除 assemblyPostProcessorType 属性解决了这个问题。修复后应该是这样的:

<compilation debug="true" targetFramework="4.5" />

希望这对其他人有所帮助。这让我的老板发疯...