Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable logging for a classic asp site

I inherited a classic ASP project and and have deployed it on a IIS 7.5. I am able to access the site, however at certain point I get a generic 500 error page. I want to know what is going on, so I think the best is to see the logs

  • Have found nothing in c:\WINDOWS\system32\LogFiles\ nor c:\inetpub\logs\
  • Tried to enable logging as here: https://technet.microsoft.com/en-us/library/cc732826(v=ws.10).aspx But I have no Logging icon/button there (see screenshot).
  • Tries custom error 500 page as here: http://www.iis.net/configreference/system.webserver/httperrors/error but there's no "Error Pages" icon (see screenshot)
  • Tried to custom 500 page with web.config as here: http://blogs.iis.net/rickbarber/archive/2013/02/18/working-past-500-internal-server-error.aspx but seems that it gets ignored

enter image description here

For the record, I am a newbie with IIS/ASP so the question can sound a bit silly.. Thanks for any suggestion!

like image 292
elkarel Avatar asked Mar 12 '15 16:03

elkarel


2 Answers

You should install the HTTP Errors feature in IIS. This is enough to view the error message -- you won't need logging.

To install HTTP Errors:

  1. Go to the Programs and Features control panel.
  2. Select "Turn Windows features on or off"
  3. Drill down to Internet Information Services > Word Wide Web Services > Common HTTP Features and select "HTTP Errors" (While you're at it, you can install the logging feature by drilling down to Internet Information Services > Word Wide Web Services > Health and Diagnostics and selecting "HTTP Logging".)
  4. Click OK to install.

Once installed, configure IIS to show detailed error messages:

  1. In the IIS settings for your site you should now see an Error Pages option. Double-click it.
  2. Click Edit Feature Settings.
  3. Select either "Detailed errors" or "Detailed errors for local requests..." depending on whether you are doing local development or not.
  4. In the IIS settings for your site, double-click the ASP option.
  5. Expand Debugging Properties and set "Send Errors To Browser" to true.

You should now see detailed error messages.

IIS logs won't help you because they do not include the detailed error messages.

like image 87
Keith Avatar answered Oct 23 '22 19:10

Keith


This will write the error info to the screen. Modify the "If blnLogFailure" section if you want to write to a file.

On Error Resume Next

Set objASPError = Server.GetLastError

blnLogFailure = TRUE

myMessage = "ERROR IN PROCESSING: " & objASPError.File & vbCrLf
myMessage = myMessage & "ASP Code: " & objASPError.ASPCode & vbCrLf
myMessage = myMessage & "Number: " & objASPError.Number & vbCrLf
myMessage = myMessage & "Source: " & objASPError.Source & vbCrLf
myMessage = myMessage & "Line Number: " & objASPError.Line & vbCrLf
myMessage = myMessage & "Description: " & objASPError.Description & vbCrLf
myMessage = myMessage & "ASP Description: " & objASPError.ASPDescription & vbCrLf

for each item in Request.ServerVariables
    myMessage = myMessage & "ITEM: " & item & " VALUE: " & Request.ServerVariables(item) & vbCrLf
next

If blnLogFailure Then
    Response.Write myMessage
End If
like image 20
Jen R Avatar answered Oct 23 '22 19:10

Jen R