I am currently undertaking a few small classic ASP migration projects while work is a little quiet. This is a first in a small series of posts about some hurdles I’ve come across in the process. This first post is some information on how you can setup debugging of classic ASP applications in Visual Studio 2008.
Firstly I’d highly recommend that you have a copy of the source locally. We work with subversion and it flows a lot easier if you work with local copies of the files. Shared source locations and subversion combine to form a rather incomprehensible disaster, but that’s just common sense I rekon.
Setup IIS
You will need IIS installed locally, you can add this in VIA add / remove programs if you did not install it with windows, as you’re likely a software developer I will assume that you have this installed. If you are having trouble, a quick google search will help you figure it out I’m sure.
Add a virtual directory for your Classic ASP application. Mine is called Monitor, so it looks something like this:
Core is another virtual directory required by my classic asp application. I’ve found that many classic ASP applications are run with several virtual directories and you will of course need to set each and every one of them up in your local to be able to run your site and thus of course debug it effectively.
Now that you have your application in IIS, you should probably test it and ensure that you at least get errors implying that it’s running correctly. To allow Visual Studio access to the source for debugging you need to configure the default web site to allow debugging. Right click the default website and choose properties. Then choose Home Directory and Configuration.
Once in the configuration page, choose the debugging tab and enable client and server-side debugging. This will allow you to attach Visual Studio to the process.
Setup Visual Studio
Visual studio is quite easy to setup. If you have not got your website in visual studio, choose file / open website and choose the same location of the virtual directory you setup in IIS. If you do not have SP1 for Visual Studio 2008 then go download it now! You won’t get any syntax highlighting or nice clean debugging for classic ASP unless you have it.
Once you have your Classic ASP Website setup in Visual Studio, you’ll need to attach it to the IIS process. Under the Debug menu, choose Attach to Process. Check the box that says “Show processes from all users” and then select the dllhost process attached to the machine, not to SYSTEM.
Breakpoint your line of code and run your application through any browser. If you can’t find the dllhost.exe attached to the local machine, then run the site first to prompt IIS.
That should work, if you still don’t hit breakpoints then you’ve run across something I did not and I’d appreciate you letting me know.
1 comment:
Great information about classic asp migration projects.
Post a Comment