How do I debug a 500 Internal Server Error on IIS 6.0 managed by Plesk (running ASP classic)?
Solution 1
The following applies to Plesk only.
Proceed to your domain in Plesk control panel and turn off "Custom Error Documents" under "Physical hosting setup". This will send error message directly to the browser.
You can also find error messages in log file directory yourdomain.com\statistics\logs\W3SVCXXXX
Solution 2
The class_terminate event can be used to create a global error handler without touching the iis config. When ASP encounters an error it server.execute's the configured 500 handler and then return to the orginal script to clean up all remaining objects.
This offers you an opportunity to create a global debugger object and use the class_terminate event to handle the errors (eg print out debug info).
Eg:
class cDebugger
private sub class_terminate
if err then
response.clear
dim asp_error
set asp_error = server.getLastError()
response.write asp_error.description
...
...
end if
end sub
end class
set [_debugger] = new cDebugger
Solution 3
An idea spurred on by Agent_9191:
At the top of the page put:
On Error Resume Next
And at the bottom of the page put:
If Err.Number <> 0 Then Response.Write(Err.Description)
Any other ideas on debugging direct from IIS without changing page code?
Jimbo
Updated on July 06, 2022Comments
-
Jimbo almost 2 years
I have read pretty much EVERY blog post, article and help document published regarding this problem and they have not helped. The most common suggestions are:
Internet Explorer -> Tools Menu -> Internet Options -> Advanced -> Show Friendly Error Messages (make sure this is NOT ticked)
IIS -> Home Directory tab -> Configuration... -> Debugging tab -> Send Detailed ASP Error message to the client (make sure this is selected)
Neither of these work and I have a feeling it has to do with Plesks management of IIS. Is there ANY way to see what these Internal Server Errors are? Even if it means browsing around the server for log files?
-
Agent_9191 over 14 yearsDo you have access to the ASP source code and can make changes to it?
-
Jimbo over 14 yearsYes, the site is owned by me (but hosted on a server with several other sites in the same IIS 6.0)
-
Jimbo over 14 yearsThis sounds like a great option, where would this code go? Thanks
-
Joost Moesker over 14 yearsPut it in an include and add this file to every page you want to debug.