Saturday, 16 June 2007

Howto: Debug classic ASP pages with Visual Studio 2003

Right. This was damn fiddly to get going on my particular setup (Windows 2003 SP1/R2, IIS6 in native mode, Visual Studio 2003) and took much googling.
However, I've now got my dev machine nicely asking me if I want to open a new instance of VS to debug local ASP errors that occur when testing with IE (incidently, I have the same occuring for Javascript - much win).

So, I'm posting this a reference. Key changes I had to make are below, with the various source links down the bottom.

Web Sites > Properties
Web Site
(1) Tick 'Enable HTTP Keep-Alives'
Home Directory
(2) Tick 'Cache ISAPI extensions'
(3) Edit the '.asp' Application extension and add DEBUG to the 'Verbs' section
(4) Tick 'Enable ASP server-side script debugging'
Cache Options [1]
(5) Select 'Cache limited ASP files in memory' and set it to '1'
Directory Security
Edit 'Authentication and access control'
(6) Tick 'Integrated Windows authentication'

[1] Note that 'Cache Options' can only be set at the root 'Web Sites' level (as far as I know).

Visual Studio
(7) Tick 'Script'

Internet Explorer
Internet Options
Trusted Sites
(8) Add the FQDN of the site you are debugging as a trusted site

RegEdit (May be needed on Win2003 SP1, requires a reboot to take effect)
(9) HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\DisableLoopbackCheck, DWORD, 1

a) JIT debugger kicks in, but VS can't find your ASP 'debug symbols'? See #5. It seems like the ASP debug symbols must be held in the IIS cache.
b) Receiving an 'unable to find webserver' error? See #9.

VS.NET Debugging Whitepaper
MSDN VS Debugging Reference
General notes 07/10/06)

No comments: