在Visual Studio中调试时,有时我添加了一个断点,但它是空心的,VS说“断点目前不会被击中。”源代码与原始版本不同。”显然,这使我无法进行调试。

这条消息到底是什么意思?什么原始版本?如果我只是打开了解决方案,而没有对代码做任何更改,又怎么会有“原始版本”呢?


当前回答

至:

Tools > Options > Debugging > General > unchecked "要求源 文件与原始版本完全匹配”

其他回答

我遇到了这个问题,这是因为我们的DevOps团队要求Azure云设置。在开发时,只需将其从Web.config中删除。

<httpRuntime maxRequestLength="102400" />

    <!--TODO #5 comment out for IIS Express fcnMode goes with httpRunTime above in other environment just in DEV -->
    <!--fcnMode="Disabled"/>-->

I suffered from this recently, and in my case I traced the problem back to something I was doing when testing: changing the system time. I'm not suggesting this is the case for everyone, but thought I'd mention it since it hasn't been mentioned already. It appears if you start moving the clock around between debug builds then it can get very confused about what order various files have been created it - I can only assume it is using file modified dates to determine if the source code is valid or not, and which binaries it needs to recompile.

这也是一个重新保存网页的选项。配置以碰撞其修改时间。

对我来说;我的网站在默认网站(http://localhost/myapp/)下的IIS应用程序中运行,并且IIS应用程序的映射指向的磁盘路径与我正在处理的源代码不同。

解决;重新映射您的IIS应用程序到与您正在构建的源代码相同的路径。

(如果您在磁盘的不同位置运行同一个应用程序的多个版本,就会发生这种情况)

我之前一直在摆弄我的csproj文件。所以在项目属性(VS 2013) > Web选项卡>服务器部分>[下拉],我有“IIS快速”选择当我以前有“本地IIS”选择。一旦我将设置修正为之前的设置,断点就可以工作了。

首先,我尝试从命令行;

从命令行删除临时文件确实有效。

C:\Windows\ Microsoft.NET \ Framework64 \ v4.0.30319 \临时ASP。>rd /s root . NET文件

当我在工具->选项->调试->通用中禁用“启用只是我的代码”选项时

这个问题为我解决了。这是一个WCF应用程序,试图调试一个ashx页面。 http://blogs.msdn.com/b/zainnab/archive/2010/10/25/understanding-just-my-code.aspx