I used to be able to attach to my w3wp process and Debug my web application, but this is not working anymore. I have no idea what changed to break this. I'm using Visual Studio 2008 SP1. And I'm debugging in IIS, not using ASP.NET's own server (i.e. I don't Run my project, I simply attach to a running process (w3wp).
我过去可以连接到w3wp进程并调试我的web应用程序,但是现在已经不能工作了。我不知道是什么改变了这一切。我使用的是Visual Studio 2008 SP1。我在IIS中调试,而不是使用ASP。NET自己的服务器(例如,我不运行我的项目,我只是附加到一个正在运行的进程(w3wp)。
My breakpoints simply have the "breakpoint will currently not be hit. The source code is different from the original version."
我的断点只是“断点目前不会被击中”。源代码与原始版本不同。
What I have tried:
我已经尝试:
- Did a solution Clean.
- 做了一个清洁的解决方案。
- Did a solution Rebuild.
- 重建做了一个解决方案。
- Made sure that compilation debug=true in my web.config file.
- 确保在我的web中编译debug=true。配置文件。
- Deleted the bin folder
- 删除本文件夹
- Restarted Visual Studio
- 重新启动Visual Studio
- Restarted IIS
- 重新启动IIS
- Restarted my Computer
- 重新启动我的电脑
- Added a simple Response.Write to ensure that the latest DLL is being used. It is.
- 添加一个简单的反应。写入以确保正在使用最新的DLL。它是。
- Made sure that Debug ASP.NET is checked in my project properties. It is.
- 确保调试ASP。NET在我的项目属性中被检查。它是。
- Made sure that all my projects are compiled in my build configuration. They are.
- 确保我的所有项目都编译在我的构建配置中。他们是。
But none of these help. I attach to w3wp, but my breakpoints never get hit.
但这些都没有帮助。我连接到w3wp,但是我的断点不会被击中。
Any ideas?
什么好主意吗?
14 个解决方案
#1
10
I had this problem recently and I ended up first making sure Visual Studio was not running at all on the system.
最近我遇到了这个问题,我首先确定Visual Studio在系统上没有运行。
Then went into this folder and deleted all its content:
然后进入该文件夹并删除其所有内容:
C:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\
#2
8
Check your web.config for
检查你的网络。配置为
<compilation debug="true">...
#3
3
When you "Attach to process", the Output window should show you (when showing output from "Debug") all the libraries it's loading, and where it's loading them from - for the dll's in your /bin folder these are usually copied to the \Temporary ASP.NET Files\root\
folder - where are yours being read from? Have you definitely cleared them out from there?
当您“附加到进程”时,输出窗口应该显示您(当显示“Debug”输出时)它正在加载的所有库,以及它从何处加载它们——对于dll位于/bin文件夹中的dll,这些通常被复制到\临时ASP中。netfiles \root\文件夹-你的从哪里读取?你已经把他们清除出去了吗?
The only other things I can think of:
我能想到的其他事情:
- You've compiled your code in "Release" mode rather than "Debug" (not the web.config) from the Solution Configuration drop-down.
- 您已经在“发布”模式下编译了代码,而不是“调试”(不是web.config)下拉解决方案配置。
- The symbol files (.pdb) are missing from your /bin folder.
- 符号文件(.pdb)在/bin文件夹中丢失。
On the "Build" tab of the project properties, you are in configuration "Active (Debug)", you haven't check "optimize code"?
在项目属性的“Build”选项卡上,您处于“Active (Debug)”配置中。,您没有检查“优化代码”吗?
If you click "Advanced..." on that tab, what value do you have for "Debug Info"? Is it "full" or "none"?
如果您单击“高级…”选项卡,那么“调试信息”的值是多少?是“满的”还是“没有”?
Responding to comment
回复评论
You will find it harder to debug successfully if your code compiled in "Release" mode, and you'll often get the "source code is different" message when you've not rebuilt the symbols (.pdb files) after changes - but you say you've done a clean/rebuild, so that should cover that.
如果您的代码是在“发布”模式下编译的,您将发现很难成功地调试,并且当您没有重新构建符号时,您将经常得到“源代码是不同的”消息。pdb文件)在修改之后-但是你说你已经完成了一个干净的/重新构建,所以应该包括这个。
Yes, your output window will show all the framework dlls that you're referencing as well as your code - but you should see one file listed in there with the name of each project output - those are the ones to look at.
是的,您的输出窗口将显示您正在引用的所有框架dll以及您的代码—但是您应该看到其中列出的一个文件,其中列出了每个项目输出的名称—这些是要查看的。
You don't have some post build event that moves files into the correct directory for your site do you that's silently failing?
您没有一些post构建事件将文件移动到您的站点的正确目录中,这是无声的失败吗?
#4
2
I also had this problem, solved it by changing the "Attach to" code type to Automatic on the "Attach To Process" dialog. (Previously I had this set to "Silverlight Code" due to debugging a different process... it can be easy to forget to change this back.)
我也有这个问题,通过将“附加到”代码类型更改为“附加到进程”对话框中的“自动”来解决。(之前我将此设置为“Silverlight Code”,因为调试了一个不同的进程……很容易忘记把它换回来。
#5
2
I know this issue has been open for some time, but I think it is the same as I experienced:
我知道这个问题已经公开了一段时间,但我认为它和我的经历一样:
I could not debug my .aspx server side code. I had a working WepApp AnyCPU project and I wanted to link to some x86 dlls, so I created an x86 debug target. Did similar things, rebuilt, stopped the development web server, rebooted, clear temporary files, all to no avail.
我无法调试.aspx服务器端代码。我有一个正在运行的WepApp AnyCPU项目,我想链接到一些x86 dll,所以我创建了一个x86调试目标。做了类似的事情,重新构建,停止开发web服务器,重新启动,清除临时文件,所有这些都无济于事。
Fixed the problem by changing the target folder to bin\ (was bin\x86\Debug).
通过将目标文件夹更改为bin\ (bin\x86\Debug),修复了这个问题。
#6
1
in the "Attach to process" dialog, click the checkbox (near the bottom) for "show processes from all users" and if you see two w3wp.exe processes, try the other one.
在“附加到进程”对话框中,单击复选框(靠近底部)以“显示来自所有用户的进程”,如果您看到两个w3wp。exe进程,尝试另一个。
One should have a comments/description value of something like T-SQL, managed somethingoranother. This is the one you want.
应该有诸如T-SQL、managed somethingor other之类的注释/描述值。这是你想要的。
#7
1
Are you running any add ins that could be affecting this? Or any tools that apply post build operations to the source code that the DLLs you start debugging with have been modified post build and it actually is correct that it's not the same source code so debugging won't work?
您是否运行了任何可能影响这一点的add ins ?或者任何将post构建操作应用到您开始调试的dll的源代码的工具都被修改了post构建,而且它不是相同的源代码,所以调试不能工作,这是正确的吗?
Also have tried resetting VS?
也尝试过重置VS?
devenv.exe /resetsettings
devenv。exe / resetsettings
Edit: if none of the information has aided you here, while painful it might be worth uninstalling and reinstalling VS and SP1. If you go through this and the issue is the same afterwards that atleast assures that the issue lies in either the web.config or the project settings.
编辑:如果没有任何信息帮助你在这里,而痛苦的是它可能值得卸载和重新安装VS和SP1。如果你经历过这个问题,那么这个问题至少保证了问题存在于网络中。配置或项目设置。
#8
1
Did you check your assembly.cs file with this attribute
你检查过你的装配了吗?具有此属性的cs文件
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.Default)]
After reflecting a optimized code you will probably get this. So you must remove this to be able to debug again.
在反映优化的代码之后,您可能会得到这个。所以您必须删除它才能再次调试。
#9
1
I faced the same issue. The w3wp process took a lot of memory and did not want to be reset on web application publishing.
我面临着同样的问题。w3wp进程占用了大量内存,不希望在web应用程序发布上重置。
Press Ctrl+Alt+Delete > Go to "Processes" tab > find w3wp process and kill it. Run the app again (if this is an mvc app, just go to a related url to automatically recreate w3wp process).
按Ctrl+Alt+Delete >到“进程”选项卡>找到w3wp进程并将其删除。再次运行该应用程序(如果这是一个mvc应用程序,请转到相关的url以自动重新创建w3wp进程)。
Warnings will disappear after that.
警告将在那之后消失。
#10
1
I have tried all the below options in my Visual Studio 2013 Update 4.
我在Visual Studio 2013更新4中尝试了以下所有选项。
- Reset IIS
- 重启IIS
- Clean solution and rebuild
- 清洁解决方案和重建
- Delete the friles from temporary folder C:\Windows\Microsoft.Net\Framework...\Temporary ASP.NET files
- 删除临时文件夹的friles C:\Windows\ Microsoft.Net \框架……\临时ASP。网络文件
- Check whether the compilation tag is debug or not
- 检查编译标记是否调试
But none of them worked, here I am listing down the two things which worked for me.
但它们都不起作用,这里我列出了对我有用的两件事。
- Disabling the "Just My Code" option Tools ->Options -> Debugging -> General -> Uncheck Enable Just My Code.
- 禁用“只是我的代码”选项工具->选项->调试->通用-> Uncheck只启用我的代码。
- Edit the web.config file and save (You can always create a space in any line in web.config, that will do)
- 编辑网页。配置文件和保存(您总是可以在web中的任何一行中创建一个空间。配置,)
Please be noted that this solution can be Visual Studio version specific, and the both fix worked for me in my Visual Studio 2013 Update 4.
请注意,这个解决方案可以是Visual Studio版本的特效,而且这两个补丁在我的Visual Studio 2013更新4中为我工作。
#11
0
I have had this problem for a while and found my solution on the MS forum (link below). Debug Diagnostic Tool was the culprit for me, but I did not have to uninstall it. I had a crash rule set up for the w3wp process and I simply removed that rule and restarted everything.
这个问题我已经有一段时间了,我在MS论坛上找到了我的解决方案(链接如下)。调试诊断工具对我来说是罪魁祸首,但我不必卸载它。我为w3wp进程设置了一个崩溃规则,我只是删除了这个规则并重新启动了一切。
Microsoft Forum for Unable to attach error
微软论坛无法附加错误。
#12
0
On OpenVMS we just used to:
在我们刚刚过去的OpenVMS上:
Compile/Debug then Link/Debug
编译/调试然后链接/调试
and that was it! Simples!!
这就是它!简单! !
but seriously, make sure the file you have your Debugger.Break line in, has 'Copy always' set in its Properties before re-building
但认真地说,请确保您有调试器。在重新构建之前,在属性中设置“复制始终”
#13
0
I was using the Visual Studio extension VSCommands to attach the debugger (convenient). However, IIS Express was running, and I guessed it might be interfering. Sure enough, when I closed IIS Express, suddenly I was able to debug again.
我使用Visual Studio扩展vscommand来附加调试器(方便)。然而,IIS Express正在运行,我猜想它可能会干扰我们。果然,当我关闭IIS Express时,我突然能够再次调试了。
Joy ensued.
欢乐随之而来。
#14
#1
10
I had this problem recently and I ended up first making sure Visual Studio was not running at all on the system.
最近我遇到了这个问题,我首先确定Visual Studio在系统上没有运行。
Then went into this folder and deleted all its content:
然后进入该文件夹并删除其所有内容:
C:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\
#2
8
Check your web.config for
检查你的网络。配置为
<compilation debug="true">...
#3
3
When you "Attach to process", the Output window should show you (when showing output from "Debug") all the libraries it's loading, and where it's loading them from - for the dll's in your /bin folder these are usually copied to the \Temporary ASP.NET Files\root\
folder - where are yours being read from? Have you definitely cleared them out from there?
当您“附加到进程”时,输出窗口应该显示您(当显示“Debug”输出时)它正在加载的所有库,以及它从何处加载它们——对于dll位于/bin文件夹中的dll,这些通常被复制到\临时ASP中。netfiles \root\文件夹-你的从哪里读取?你已经把他们清除出去了吗?
The only other things I can think of:
我能想到的其他事情:
- You've compiled your code in "Release" mode rather than "Debug" (not the web.config) from the Solution Configuration drop-down.
- 您已经在“发布”模式下编译了代码,而不是“调试”(不是web.config)下拉解决方案配置。
- The symbol files (.pdb) are missing from your /bin folder.
- 符号文件(.pdb)在/bin文件夹中丢失。
On the "Build" tab of the project properties, you are in configuration "Active (Debug)", you haven't check "optimize code"?
在项目属性的“Build”选项卡上,您处于“Active (Debug)”配置中。,您没有检查“优化代码”吗?
If you click "Advanced..." on that tab, what value do you have for "Debug Info"? Is it "full" or "none"?
如果您单击“高级…”选项卡,那么“调试信息”的值是多少?是“满的”还是“没有”?
Responding to comment
回复评论
You will find it harder to debug successfully if your code compiled in "Release" mode, and you'll often get the "source code is different" message when you've not rebuilt the symbols (.pdb files) after changes - but you say you've done a clean/rebuild, so that should cover that.
如果您的代码是在“发布”模式下编译的,您将发现很难成功地调试,并且当您没有重新构建符号时,您将经常得到“源代码是不同的”消息。pdb文件)在修改之后-但是你说你已经完成了一个干净的/重新构建,所以应该包括这个。
Yes, your output window will show all the framework dlls that you're referencing as well as your code - but you should see one file listed in there with the name of each project output - those are the ones to look at.
是的,您的输出窗口将显示您正在引用的所有框架dll以及您的代码—但是您应该看到其中列出的一个文件,其中列出了每个项目输出的名称—这些是要查看的。
You don't have some post build event that moves files into the correct directory for your site do you that's silently failing?
您没有一些post构建事件将文件移动到您的站点的正确目录中,这是无声的失败吗?
#4
2
I also had this problem, solved it by changing the "Attach to" code type to Automatic on the "Attach To Process" dialog. (Previously I had this set to "Silverlight Code" due to debugging a different process... it can be easy to forget to change this back.)
我也有这个问题,通过将“附加到”代码类型更改为“附加到进程”对话框中的“自动”来解决。(之前我将此设置为“Silverlight Code”,因为调试了一个不同的进程……很容易忘记把它换回来。
#5
2
I know this issue has been open for some time, but I think it is the same as I experienced:
我知道这个问题已经公开了一段时间,但我认为它和我的经历一样:
I could not debug my .aspx server side code. I had a working WepApp AnyCPU project and I wanted to link to some x86 dlls, so I created an x86 debug target. Did similar things, rebuilt, stopped the development web server, rebooted, clear temporary files, all to no avail.
我无法调试.aspx服务器端代码。我有一个正在运行的WepApp AnyCPU项目,我想链接到一些x86 dll,所以我创建了一个x86调试目标。做了类似的事情,重新构建,停止开发web服务器,重新启动,清除临时文件,所有这些都无济于事。
Fixed the problem by changing the target folder to bin\ (was bin\x86\Debug).
通过将目标文件夹更改为bin\ (bin\x86\Debug),修复了这个问题。
#6
1
in the "Attach to process" dialog, click the checkbox (near the bottom) for "show processes from all users" and if you see two w3wp.exe processes, try the other one.
在“附加到进程”对话框中,单击复选框(靠近底部)以“显示来自所有用户的进程”,如果您看到两个w3wp。exe进程,尝试另一个。
One should have a comments/description value of something like T-SQL, managed somethingoranother. This is the one you want.
应该有诸如T-SQL、managed somethingor other之类的注释/描述值。这是你想要的。
#7
1
Are you running any add ins that could be affecting this? Or any tools that apply post build operations to the source code that the DLLs you start debugging with have been modified post build and it actually is correct that it's not the same source code so debugging won't work?
您是否运行了任何可能影响这一点的add ins ?或者任何将post构建操作应用到您开始调试的dll的源代码的工具都被修改了post构建,而且它不是相同的源代码,所以调试不能工作,这是正确的吗?
Also have tried resetting VS?
也尝试过重置VS?
devenv.exe /resetsettings
devenv。exe / resetsettings
Edit: if none of the information has aided you here, while painful it might be worth uninstalling and reinstalling VS and SP1. If you go through this and the issue is the same afterwards that atleast assures that the issue lies in either the web.config or the project settings.
编辑:如果没有任何信息帮助你在这里,而痛苦的是它可能值得卸载和重新安装VS和SP1。如果你经历过这个问题,那么这个问题至少保证了问题存在于网络中。配置或项目设置。
#8
1
Did you check your assembly.cs file with this attribute
你检查过你的装配了吗?具有此属性的cs文件
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.Default)]
After reflecting a optimized code you will probably get this. So you must remove this to be able to debug again.
在反映优化的代码之后,您可能会得到这个。所以您必须删除它才能再次调试。
#9
1
I faced the same issue. The w3wp process took a lot of memory and did not want to be reset on web application publishing.
我面临着同样的问题。w3wp进程占用了大量内存,不希望在web应用程序发布上重置。
Press Ctrl+Alt+Delete > Go to "Processes" tab > find w3wp process and kill it. Run the app again (if this is an mvc app, just go to a related url to automatically recreate w3wp process).
按Ctrl+Alt+Delete >到“进程”选项卡>找到w3wp进程并将其删除。再次运行该应用程序(如果这是一个mvc应用程序,请转到相关的url以自动重新创建w3wp进程)。
Warnings will disappear after that.
警告将在那之后消失。
#10
1
I have tried all the below options in my Visual Studio 2013 Update 4.
我在Visual Studio 2013更新4中尝试了以下所有选项。
- Reset IIS
- 重启IIS
- Clean solution and rebuild
- 清洁解决方案和重建
- Delete the friles from temporary folder C:\Windows\Microsoft.Net\Framework...\Temporary ASP.NET files
- 删除临时文件夹的friles C:\Windows\ Microsoft.Net \框架……\临时ASP。网络文件
- Check whether the compilation tag is debug or not
- 检查编译标记是否调试
But none of them worked, here I am listing down the two things which worked for me.
但它们都不起作用,这里我列出了对我有用的两件事。
- Disabling the "Just My Code" option Tools ->Options -> Debugging -> General -> Uncheck Enable Just My Code.
- 禁用“只是我的代码”选项工具->选项->调试->通用-> Uncheck只启用我的代码。
- Edit the web.config file and save (You can always create a space in any line in web.config, that will do)
- 编辑网页。配置文件和保存(您总是可以在web中的任何一行中创建一个空间。配置,)
Please be noted that this solution can be Visual Studio version specific, and the both fix worked for me in my Visual Studio 2013 Update 4.
请注意,这个解决方案可以是Visual Studio版本的特效,而且这两个补丁在我的Visual Studio 2013更新4中为我工作。
#11
0
I have had this problem for a while and found my solution on the MS forum (link below). Debug Diagnostic Tool was the culprit for me, but I did not have to uninstall it. I had a crash rule set up for the w3wp process and I simply removed that rule and restarted everything.
这个问题我已经有一段时间了,我在MS论坛上找到了我的解决方案(链接如下)。调试诊断工具对我来说是罪魁祸首,但我不必卸载它。我为w3wp进程设置了一个崩溃规则,我只是删除了这个规则并重新启动了一切。
Microsoft Forum for Unable to attach error
微软论坛无法附加错误。
#12
0
On OpenVMS we just used to:
在我们刚刚过去的OpenVMS上:
Compile/Debug then Link/Debug
编译/调试然后链接/调试
and that was it! Simples!!
这就是它!简单! !
but seriously, make sure the file you have your Debugger.Break line in, has 'Copy always' set in its Properties before re-building
但认真地说,请确保您有调试器。在重新构建之前,在属性中设置“复制始终”
#13
0
I was using the Visual Studio extension VSCommands to attach the debugger (convenient). However, IIS Express was running, and I guessed it might be interfering. Sure enough, when I closed IIS Express, suddenly I was able to debug again.
我使用Visual Studio扩展vscommand来附加调试器(方便)。然而,IIS Express正在运行,我猜想它可能会干扰我们。果然,当我关闭IIS Express时,我突然能够再次调试了。
Joy ensued.
欢乐随之而来。