How to debug classic ASP pages in VS 2005
Quite a few people were unable to make VS 2005 to hit breakpoints in the server script in classic ASP pages. Little surprise here since the way we do ASP debugging changed since VS 2003 and there little or no information currently in VS 2005 Beta 2 docs on the topic (I filed a bug on this). Most importantly, setting BP and hitting F5 won't work - breakpoint never binds. Two key items here:
1. Classic ASP debugging only works with IIS. It does not work with the VS Development Web Server (Cassini).
2. In VS 2005 you have to attach to the ASP worker process (w3wp.exe in IIS 6).
Here is how to make ASP debugging work:
1. Enable ASP debugging on the server. (I also added DEBUG verb to the asp extension, but I am not sure if it is required).
2. Open classic ASP in VS 2005.
3. Set breakpoint.
4. View page in browser or run without debugging.
5. Debug | Attach to Process
6. Locate IIS ASP worker process (w3wp.exe on IIS6) which exposes x86 and Script and attach as Script.
At this point breakpoint should bind and you should be able to hit it. You may have to refresh the page in the browser to get the code executed again. I tried on Windows 2003 SP1 Standard Server running IIS 6 and it worked for me. I want to try on XP Pro + IIS 5 next.
Comments
Anonymous
June 24, 2005
Hi, Mikhail
It is somewhat not related to the topic, but I have some questions regarding VS2005 and the new asp.net 2.0 model. (I'm in the middle of conversion of the big project from 1.1 to 2.0)
1) server controls inside user controls (for example dropdownlist). Because of the new model I can not declare it in the code behind, they are already declared as protected from aspx code.
In asp.net 2.0 I had some of these controls declared as public in order to have access from the outside. Now they are all protected, so it gives compilation errors. Is there any elegant way to solve this ?Anonymous
June 28, 2005
The comment has been removedAnonymous
August 22, 2005
What about steps
5)Debug | Attach to Process and
6)Locate IIS ASP worker process (w3wp.exe on IIS6) which exposes x86 and Script and attach as Script
Can you describe the details to carry out these actions?
ThanksAnonymous
August 24, 2005
You access Attach to Process command in the Debug menu. It display a window with all processes running in OS that you can attach to. One of the processes will be w3wp and type of code will be x86 and Script. Select the process and at the top of the dialog choose Script instead of Automatic. Click Attach.Anonymous
October 06, 2005
I'm trying to debug classic ASP in VS 2005 and have tried everything to get it to work. I open the web site as a web project. Then when I do Debug.StartWithoutDebugging it runs the web site from //localhost and everything looks good. But I cannot attach to the ASP.NET worker process because it's not running. No matter what I try, the worker process doesn't run which seems to make sense because the pages are ASP not ASP.NET. Any ideas on why this is happening or what I can try? Thanks.Anonymous
October 12, 2005
You need to attach to ASP worker process, not ASP.NET process.Anonymous
October 16, 2005
If this is true, then how on earth can you now debug code in the application startup event in classic ASP ?
You can't attach to the w3wp.exe process when you application startup code it running so you have run it from a project in VS.NET 2003. Are you saying there is therefore now not a way to debug the startup event ?Anonymous
January 07, 2006
FYI -
When running on XP Pro/IIS 5, you need to attach to dllhost.exe instead of w3wp.exe. You may have more than one instance of dllhost running on your machine, so look for the one with Type "Script, x86" and the User Name column indicates your IIS process account (IWAM_machinename).Anonymous
January 09, 2006
I have a clarification. I used to debug ASP application in VS 2003. I shut down the system and the next day, when I tried to Debug Process, it gave me an error.
---------------------------
Microsoft Development Environment
---------------------------
Processes cannot be displayed. Access is denied. Verify that you are an administrator or a member of the 'Debugger Users' group on the machine you are trying to debug. After being added to the 'Debugger Users' group, you must log off and log back on for the setting to apply.
---------------------------
OK
---------------------------
Can you help me on this? My account is administrator account and is added in "Debugging users" group.
Thanks.
ArunAnonymous
February 01, 2006
Hi Mikhail,
I can attach to the worker process (dllhost Script x86) but it clearly is not fully attached, as break point are never activated, and even the OutputDebugString() output is NOT being captured.
When I do the same with VS 2003, i.e attaching to the SAME dllhost process, it DOES capture the OutputDebugString output, and break points DO activate, but my symbolic info does NOT load (compiled with VS 2005).
FWIW, I can see 2 dllhost process, and I did try attaching to EACH seperatly as well as BOTH.
Finally, the script engine I try to debug is compiled with VS 2005 using full debug info, and oherwise functions perfectly.
What am I missing?
RonAnonymous
February 01, 2006
Oops, sorry in VS 2003, with the project compiled with VS 2005, the break points do NOT activate, because teh symbolic info is not loaded, but the DEbugger DOES capture OutputDebugString(), and it DOES capture exceptions. It also DID activate break point when the project was compiled with VS 2003.
I also found I CAN tell my project to use "Web Service Debugger" and when I use url such as http://LocalHost/test.asp it DOES start IE, and it does capture an Error info posted by means of IActiveScriptSite::OnScriptError(), but break point which should have trigger BEFORE that point are NOT intercepted.
TIA,
RonAnonymous
February 01, 2006
The comment has been removedAnonymous
February 06, 2006
Hi Mikhail,
I have a question about ASP debugging. Have class library written in VB6 that is call from classic asp page. Can I debugg it all together with VS 2005 and VS 6 as I can debbug it with VS 2003 and VS 6.
I try debugging asp page with VS 2005 and it works but in that page I have calls of methods from some extern class written in VB6, that I need to debugg it also. I can not join this 2 debuggings.
Regards,
IgorAnonymous
February 06, 2006
Hi Mikhail,
Thanks a lot for your posts. They have really helped me a lot already.
I have been trying to get Classic ASP debugging working with VS2005, in a mixed project of both .aspx and .asp files. The only difference is that I am using XP Pro with IIS 5.1
I followed your steps for enabling debugging. Instead of attaching to w3wp.exe, I am attaching to the inetinfo.exe process.
I can start without debugging, and then if I position my cursor inside the script or <% tags. I am able to set a breakpoint.
By then refreshing the .asp page using Ctrl-F5, my breakpoint is not hit, and the comment inside the Visual Studio IDE when I hover over the breakpoint symbol in the margin says: 'The breakpoint will not currently be hit, no symbols have been loaded for this document'
As a result, I was almost, but not quite able to show that debugging classic ASP pages is possible in IIS5.1 on XP
I am not able to spend any more time on this, so perhaps someone else can pick this up?
Best wishes
Graham.Anonymous
February 07, 2006
Some time ago I blogged about how to debug classic ASP applications in VS 2005 with IIS 6. A few people...Anonymous
March 05, 2006
greatAnonymous
March 15, 2006
I blogged earlier how to debug classic ASP with VS 2005 on IIS5 and on IIS6. However, attaching to a...Anonymous
April 23, 2006
Anyone know if you can debug classic ASP with Visual Web Developer Express? The Debug window does not have an option to attach to a process.Anonymous
April 24, 2006
No, I don't think it is possible. VWD Express does not support attaching to processes.Anonymous
May 03, 2007
Dave got a request to allow someone to setup Visual Studio 6 so they could use Visual InterDev. I’mAnonymous
October 07, 2007
PingBack from http://blog.smartconsulting.com.br/2007/10/07/dedugando-asp-no-visual-studio-2005-iis-51/Anonymous
October 09, 2007
Visual Studio 2005 で classic ASP をデバッグする方法Anonymous
November 14, 2007
The comment has been removedAnonymous
November 21, 2007
PingBack from http://www.lazycoder.com/weblog/index.php/archives/2007/11/22/links-for-2007-11-22/Anonymous
December 21, 2007
PingBack from http://bobondevelopment.com/2007/12/21/a-reason-to-keep-a-project-on-visual-studio-2003-in-2007/Anonymous
March 10, 2008
好久没更新过了。翻找了下,这两篇博客指导了如何做1、2,记录下。要用到的工具ListDlls简单地说1.VS自带的Cassini不支持ASPdebug,必须用IIS,而且2.要用vs2005A...Anonymous
August 27, 2008
PingBack from http://www.nankaipan.cn/blog/?p=16Anonymous
January 21, 2009
PingBack from http://www.hilpers.it/2608812-debug-asp-netAnonymous
January 21, 2009
PingBack from http://www.keyongtech.com/477952-80131534-error-trying-to-instantiate