lundi 6 novembre 2006

How to debug classic ASP pages in Visual Studion 200 5 (VS2005)

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.

NOTE FOR IIS 5
:
This seems to work with my system, only I attached to the dllhost.exe(instead of w3wp.exe because I'm running IIS 5.0) running under the IWapUser Name. It gave me a warning, and asks if I want to attach to thisprocess, I clicked the 'Attach' button and my break points were hit. Two key items here:
  1. Classic ASP debugging only works with IIS. It does not work with the VS Development Web Server.
  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.



FROM MICROSOFT: http://msdn2.microsoft.com/en-us/library/ms178108(VS.80).aspx

To specify the Web server for a Web site in Visual Studio 2005:
  1. In Solution Explorer, right-click the name of the Web site for which you want to specify a Web server, and then click Property Pages.
  2. In the Property Pages dialog box, click the Start Options tab.
  3. Under Server, click Use custom server.
  4. In the Base URL box, type the URL that Visual Web Developer should start when running the current Web site.

Aucun commentaire:

Publier un commentaire