Click here to Skip to main content
Click here to Skip to main content

Debugging Classic ASP ( VBScript ) in Visual Studio 2008

By , 23 Aug 2008
 

Introduction

This is a step by step guide on how to set up your project so you can debug a site written in classic ASP VBScript using Visual Studio 2008.

Using the Code

I walk you step by step through how to set up your project so you can debug a site written in classic ASP VBScript using Visual Studio 2008.

1.1 Setup IIS

1.1.1 Configure Default IIS web site on a local machine to point to the directory the Classic ASP web site is in and turn on ASP server side debugging:

iis-enable-asp-server-side-debugging.gif

1.2 Setup Project in Visual Studio 2008

Since we're talking "classic ASP" written in VBScript, you'll already have a web site. So I'll cover opening an existing site.

1.2.1 Launch Visual Studio 2008

1.2.2 File >> Open >> Web Site

1.2.3 Navigate to the directory that contains the ancient code you have to work with, select it and it opens.

1.2.4 Right click the web site in Solution Explorer

1.2.5 Go to Properties >> Start Options

1.2.6 Configure it to use custom server with Base URL of http://localhost

vs2008-start-options.gif

1.3 Start Debugger

1.3.1 Run application (F5)

1.3.2 Select Visual Studio 2008 as your debugger of choice

1.3.3 Attach to dllhost.exe

attach-to-dllhost.gif

1.3.4 Your browser launches

1.3.5 A new instance of Visual Studio launches

1.3.6 Close the new instance of Visual Studio but leave the browser open.

1.3.7 In the instance of Visual Studio that you opened the web site in, click Debug >> Attach to Process

1.3.8 Check Show process from all users

1.3.9 Select entry for dllhost.exe with type Script, T-SQL, x86

1.3.10 Click Attach

debug-attach-to-process.gif

1.3.11 Just to make sure things are in working order, set a break point at the beginning of your code and click refresh on the browser that was launched when you clicked F5.

1.3.12 Send me a nice thank you.

1.4 Restart Debugging Browser

You will need to reattach to the debugger process if you close the browser.

1.4.1 Hit F5 to launch a new browser window with your application in it. If it acknowledges your breakpoints, then never mind, you're already in business. If not then....

1.4.2 With the browser window still open back in Visual Studio, simply click Debug and then Attach to Process in the drop down menu.

1.4.3 Select entry for dllhost.exe with type Script, T-SQL, x86

1.4.4 Click Attach

1.4.5 Click refresh in the browser F5 launch and Bob's your uncle you're back in business.

History

  • 23rd August, 2008: Initial post 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Rock Webcast
Unknown
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionNot working with Visual Studio 2010 & XPmemberDBLWizard22 Feb '13 - 5:24 
I'm trying to get this to work on XP and can't seem to get it. When I run (1.3.1) I don't get a prompt to select the debugger it just opens a browser and shows Visual Studio as "running". Did anybody have some other step that had to do to make this work?
 
Thanks
 
dbl
QuestionTry this too, macro methodmemberawilbourn3 Sep '12 - 1:30 
http://blogs.msdn.com/b/greggm/archive/2006/03/15/552108.aspx[^]
GeneralMy vote of 5membermanoj kumar choubey1 Apr '12 - 21:41 
Nice
QuestionChange location of VWDWebCachememberstillmc6 Jul '11 - 5:58 
Thanks for the article. Does anyone know how to change the location of VWDWebCache? It currently points to my temp directory, but I would like this to be under the solution's directory for various reasons. Any ideas?
GeneralMy vote of 3memberSohini Dey2119 Aug '10 - 0:37 
good
Generalthanks. Worked for Visual Studio 2010.memberbnighter12 Aug '10 - 9:04 
Very helpful. Windows XP. IE 6.0.
GeneralMy vote of 5membervincuo6 Jul '10 - 5:54 
Quick and Simple
GeneralThanksmembervoavictoriano22 Jan '10 - 3:04 
thanks, you saved my life, a little exaggerated but real. when I was about to cry I read your article and problem solved!!!!
thanks again
 
oscar
 
original message / mensaje original:
gracias, usted salvo mi vida, un poco exagerado pero real. cuando ya estaba por gritar leí tu articulo y problema solucionado
Gracias nuevamente
 
oscar
QuestionRemote debuging classic ASP?memberJoeik8 Dec '09 - 13:39 
Really nice article, i have problem with making this work remotely tho. i can attach to right proces but breakpoints are empty. Does anybody have any experience on debuging classic asp remotely from vs2008?
AnswerRe: Remote debuging classic ASP?memberfaina22 Dec '09 - 23:52 
I debug classical asp in Microsoft Visual Studio 2008 - Versione 9.0.30729.1 SP; the web is hosted in IIS7 on a Windows7 pc.
 
1.1 Setup IIS is similar; just set debug property on IIS-ASP..debug properties
 
1.2.6 is not possible nor necessary.
Just leave "Use default web server", but in VS select menu Tools->Options..Debug..General and set "Attiva il supporto del server di origine" (sorry, I've italian version!)
 
1.3.3 When VS debug is NOT running, but you have the page to debug open in you browser, attach to process w3wp.exe (you'll need to check "Mostra i processi in tutte le sessioni")
AnswerRe: Remote debuging classic ASP?memberAlexStevens10 Jun '12 - 9:58 
Maybe this will help somebody. I've been using a tool for classic asp debugging called team remote asp debugger for over 8 years now, very highly recommended, I think it's the only classic asp debugger out there that actually allows remote asp debugging without attaching to process. I think the link is still the same http://www.remotedebugger.com
They've been very good with support, and from my experience with them, they seem to be experts in classic ASP, they always answered my questions within minutes.
Hope this helps.
Cheers,
Alex
GeneralRestart website in iis if you have this error when attachingmemberpedrogameiropinto29 Jul '09 - 5:11 
Restart website in iis if you have an error when attaching to dllhost.exe
The error usually says that you can't attach because there is already a debugger attached
GeneralThis is very cool, but...memberPRMan!!!15 Jul '09 - 7:34 
Great tutorial, and this is doing wonders on some old ASP code I have to maintain which is just a horrible mess of copy and paste.
 
But, how do I end the session without crashing VS2008? Every time I stop the browser or hit stop in VS, I get a message asking if I want to send data to Microsoft and then VS2008 gets unstable and restarts.
 
Any ideas?
GeneralRe: This is very cool, but...memberPRMan!!!15 Jul '09 - 7:56 
OK, DON'T check debug client side but ONLY server side.
Generalit only worked for a couple of daysmemberopensas29 Jun '09 - 12:42 
great article...
 
I could make it work for a couple of days, but now I can no longer find the dllhost.exe process of type "Script,x86", so I can no longer debug asp code...
 
please help!!!
 
any ideas???
 
win xp SP 3, VS 2008 9.0.30729.1SP, .net 3.5 SP1, IIS 5.1
GeneralRe: it only worked for a couple of daysmemberwalash10 Nov '09 - 7:13 
Hi, I had the same problem. I fixed it out installing Service Pack 1 for my Visual Studio 2008. And now I attach to "inetinfo.exe" process.
Generalcan't find the correct dllhost.exe entrymembercagilbert22 May '09 - 14:29 
I can get to 1.3.9 but don't see an entry for dllhost.exe that is Script, T-SQL, x86. Above in the field Attach To: it says Native Code. I can use Select to check boxes for Script and T-SQL, but when I do Refresh it still doesn't list the dllhost.exe with Script, T-SQL, x86. I chose it anyway, but VS 2008 crashed. I re-opened and now when I do Start Debug (F5) it opens up my browser but gives me a directory listing, not the default web page.
 
Thanks
GeneralRe: can't find the correct dllhost.exe entrymembercagilbert22 May '09 - 14:30 
P.S. I chose dllhost.exe with just Script, x86 but without T-SQL.
GeneralProblem applying your solutionmemberTokorie6 Apr '09 - 19:26 
I assume in step 1.3.3 dllhost.exe has to be running on the machine in order for this to work. I am working on a Vista Machine with IIS 7, and my application residing in a virtual folder on my local drive. I don’t however have dllhost.exe running automatically on my machine. What happens is that when I run my web application (F5) and then select Visual studio 2008 as my debugger of choice, I do not get the prompt as shown in step 1.3.3.
 
Even when I select to manually choose a debugging machine, I still do not get that prompt. I instead get the following prompt “Unable to attach debugger. A debugger is already attached”. Any idea how I can resolve this problem? I would like to start debugging my classic ASP pages in Visual Studio 2008.
AnswerRe: Problem applying your solutionmemberblborg14 May '09 - 2:18 
Not sure if this helps .. but i had similar problem and attached to w3wp.exe instead, which in my case did the trick.
 
Steps.
1- Ensure you got vs2008sp1.
2- Enable debugging on IIS for classic ASP.
3- Open browser manually and browse to your site.
4- Open VS2008, and attach to w3wp.exe.
 
Good luck
QuestionHow to set nested application to application within built in web servermemberjoeller3 Mar '09 - 6:00 
Tried to follow the steps as outlined. However, my Classic ASP app has three Web Services applications located within its directory structure. Therefore on build I get is "It is an error to use a section register as allowDefinition='MachineToApplication' ..." If I was running this website as an IIS website I would configure those virtual directories as applications and problem solved. But IIS is forbidden on this machine by government mandate. So how can I configure those directories as virtual directories using the VS development Web Server? so I can successfully F5 the web site?Confused | :confused:
GeneralThank you!!!memberAndrew J Dixon3 Feb '09 - 12:33 
I was attaching to the IE process and getting nowhere.
simple, clear explanation - you have saved my sanity.
GeneralImprovements in Visual Studio 2008memberMikeGale18 Oct '08 - 21:47 
With SP1 Visual Studio 2008 is now better.
 
It regains the ability to debug ASP code.
 
The debugging is not a first class citizen. You can't simultaneously debug JavaScript and ASP server side code, you need to run two debug sessions instead.
 
As mentioned elsewhere when using IIS and real sites (as opposed to localhost) the details are different.
GeneralNeed to do it slightly different under Server 2008.memberMember 116013619 Sep '08 - 9:17 
To get this to work under Server 2008 (x64) with Visual Studio 2008 (SP1) the setup is pretty much the same (accounting for differences in IIS). However, it still won't work unless you follow the correct steps to invoke debugging.

Setup
1. Enable server side debugging for ASP under IIS.
1a. Run inetmgr.exe
1b. Select "Sites/Default Web Site" from the tree on the left.
1c. Click on the ASP icon in the features view in the middle.
1d. Expand the Debugging properties and change "Enable Server-side debugging" and
"Send Errors to Browser" to true.
 
2. Run Visual Studio as Administrator.
3. Right Click the web project and select Properties.
4. Select the "Web" tab on the left. Select "Use Custom Web Server" and put in the appropriate Server URL: "http://localhost".
 
Debugging
1. Make sure you are running Visual Studio as administrator.
2. Press Ctl-F5 to run without debugging.
3. Select "Debug/Attach to process".
4. Make sure the boxes "Show processes from all users" and "Show processes in all sessions" are checked.
5. Click the button "Select" to the right of "Attach to:" and make sure it is set to "Automatically determine the type of code to debug".
6. Click OK at the botton.
 
At this point your breakpoints should be recognized.
GeneralRe: Need to do it slightly different under Server 2008.memberOwen372 Oct '09 - 6:08 
This also works in Vista! THANKS! Big Grin | :-D

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 23 Aug 2008
Article Copyright 2008 by Rock Webcast
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid