未命中 Visual Studio 断点 [英] Visual Studio breakpoints not being hit

查看:30
本文介绍了未命中 Visual Studio 断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个 ASP.NET MVC 项目,该项目在附加到 IIS 进程 (w3wp.exe) 时似乎遇到了一些问题.我在自己的本地机器上运行解决方案和 IIS 8.5,所以我认为这与我们的网络没有任何关系.令我感到奇怪的是,我能够在本地调试的任何其他解决方案上找到断点.

I'm working with an ASP.NET MVC project that seems to be having some issues when attaching to the IIS process (w3wp.exe). I'm running the solution and IIS 8.5 on my own local machine so I wouldn't think that this has anything to do with our network. What's strange to me is that I'm able to hit the breakpoints on any other solution I debug locally.

我真正遇到的问题是断点变成红色的空心圆圈并且永远不会被击中.通常对此的修复是解决方案的清理/重建,但这并没有奏效.我已经通过向页面添加抛出新异常"并确保它显示异常来确认代码正在更新.同样,这个问题只发生在这个解决方案中.我运行调试器的任何其他解决方案都可以正常工作.我还尝试重新启动应用程序池、网站、IIS 以及我的计算机.

The issue I'm having exactly is that the breakpoints turn to red, hollow circles and never get hit. Usually the fix for this is a Clean/Rebuild of the solution but this hasn't worked. I've confirmed the code is being updated by adding "throw new Exception" to a page and ensuring it shows the exception. Again, this problem is only happening with this one solution. Any other solution I run the debugger with works fine. I've also tried restarting the app pool, the website, IIS, and also my computer.

我读过的一些文章提到防病毒程序可以阻止远程调试器访问进程.但是,整个设置都包含在我的本地机器上,所以听起来这不是问题.不过这确实让我有点担心,因为我们最近聘请了一名新的 IT 人员,他对每个人的机器进行了大量更改.

A few of the articles I read mentioned that anti-virus programs can block a remote debugger from accessing the process. However, the entire setup is contained on my local machine so it doesn't sound like that would be the issue. It does concern me a bit though because we recently hired a new IT guy that's been making a lot of changes to everyone's machine.

该 Web 应用程序的另一个独特之处是 IIS 中的绑定.绑定是*"以利用与子域相关的一些自定义功能.

One other point to add that's unique about this web application is the binding in IIS. The binding is "*" in order to leverage some custom functionality related to subdomains.

与此同时,我将继续寻找解决方案,但如果有人有任何想法可能导致此解决方案无法正确调试,我将非常感激.

In the meantime, I'll continue to look for a solution but if anybody has any ideas what may be causing this one solution to not debug properly I'd really appreciate it.

找到了建议删除 ASP.NET 临时文件的解决方案.没有运气.

Found a solution that suggested deleting the ASP.NET temporary files. No luck.

推荐答案

已解决.最终在调试菜单中选择了不正确的配置.我错误地将其切换到无法加载文档符号的发布配置.将它切换到调试配置,断点现在很好.

Solved. Ended up being an incorrect configuration selected in the debug menu. I had mistakenly switched it to a release configuration that could not load the symbols for the document. Switched it to a debug configuration and the breakpoints hit just fine now.

为了补充下面提到的 Abacus,它也可能是一个扰乱您的构建的 web.config 转换.在我们的例子中,我们有从 web.config 的编译部分中删除 debug 属性的 Release 配置.下面是一个示例和 Visual Studio 的构建配置下拉列表的屏幕截图.

To add on to what Abacus mentioned below, it could also be a web.config transform that is messing with your build. In our case, we have Release configurations that remove the debug attribute from the web.config's compilation section. Below is a screenshot of an example and Visual Studio's dropdown list of build configurations.

注意:还要确保您的平台以及配置正确无误.就我而言,Dev.Debug|Mixed Platforms 无法正确构建解决方案,但 Dev.Debug|Any CPU 会.

NOTE: Also make sure your Platform is correct along with the configuration. In my case, Dev.Debug|Mixed Platforms does not correctly build the solution but Dev.Debug|Any CPU will.

这篇关于未命中 Visual Studio 断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆