Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
787 views
in Technique[技术] by (71.8m points)

iis 7 - Internal Server Error 500 w/ IIS Log

I am getting some errors on my classic asp website. When the website runs for the first time it sometimes does an Internal Server Error. Then a refresh would fix it. I decided to check my IIS logs to see what the problem is but i can't interpret it. Here is the log line

  2013-12-09 15:29:00 xx.xx.xx.xx GET / |37|80070005|Access_is_denied.__ 80 - xx.xxx.xx.xx Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/31.0.1650.63+Safari/537.36 500 0 0 702
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

How about setup custom pages for handle 500 and 500 100 errors?

  1. Create some folder, let's say D:InetPubWeb01Err Add IUSR_Web01 user with write permission

  2. In IIS for Web01 web site (sample for IIS 6.0) enter image description here

  3. Put following code in file 500.asp and 500100.asp

    Option Explicit
    Response.Buffer = True
    Response.Expires = -1
    Response.ExpiresAbsolute = #Jan 31,2000 12:30:00#
    
    Response.Clear
    
    Dim FS, TF, N, ASPErr
    N = Now
    
    Set ASPErr = Server.GetLastError() 
    
    Set FS = CreateObject ("Scripting.FileSystemObject")
    Set TF = FS.CreateTextFile ("D:InetPub1click.lvErr500 " & "Error" & Right ("0" & Year (N), 4) & Right ("0" & Month (N), 2) & Right ("0" & Day (N), 2) & "_" & Right ("0" & Hour (N), 2) & Right ("0" & Minute (N), 2) & Right ("0" & Second (N), 2) & ".txt", True, False)
    TF.Write MyErrorInfo (ASPErr, False, False, "1click.lv", "")
    TF.Close
    Set FS = Nothing
    
    Response.Write MyErrorInfo (ASPErr, True, True, "1click.lv", "zam@1click.lv")
    Err.Clear
    

The function:

Function MyErrorInfo (ASPErr, AsHTML, ShowContactInfo, WebTitle, AdminEmail)
    Dim Result
    Result = ""
    If AsHTML = True Then
        Result = Result & "<html><head><title>Error occur</title></head><body><font face=Verdana size=2>"
        If (ShowContactInfo = True) Then
            Result = Result & "<p align=center>"
            Result = Result & "<font size=4>"
            Result = Result & "<font color=""#008000"">" & WebTitle & "</font><br>"
            Result = Result & "<font color=""#800000"">500 Error occur</font><br>"
            Result = Result & "Please contact us by email at <a href=""mailto:" & AdminEmail & """>" & AdminEmail & "</a> and inform about this error<br><br>"
            Result = Result & "Thank you for your support!"
            Result = Result & "</font>"
            Result = Result & "</p>"
        End If
        Result = Result & "<hr>"
        Result = Result & "Error number: <b>" & ASPErr.Number & "</b><br>"
        Result = Result & "Error source: <b>" & ASPErr.Source  & "</b><br>"
        Result = Result & "Error description: <b>" & ASPErr.Description & "</b><br>"
        Result = Result & "Error line: <b>" & ASPErr.Line & "</b><br>"
        Result = Result & "Client IP: <b>" & Request.ServerVariables ("REMOTE_ADDR") & "</b><br>"
        Result = Result & "Client Browser: <b>" & Request.ServerVariables ("HTTP_USER_AGENT") & "</b><br>"
        Result = Result & "Client Referer: <b>" & Request.ServerVariables ("HTTP_REFERER") & "</b><br>"
        Result = Result & "Path: <b>" & Request.ServerVariables ("PATH_INFO") & "</b><br>"
        Result = Result & "Request method: <b>" & Request.ServerVariables ("REQUEST_METHOD") & "</b><br>"
        Result = Result & "Request FORM: <b>" & Request.Form & "</b><br>"
        Result = Result & "Request QUERY: <b>" & Request.QueryString & "</b><br>"
        Result = Result & "<hr>"
        Result = Result & "</font></body></html>"
    Else
        Result = Result & WebTitle & vbCrLf
        Result = Result & "Error number: " & ASPErr.Number & vbCrLf
        Result = Result & "Error source: " & ASPErr.Source  & vbCrLf
        Result = Result & "Error description: " & ASPErr.Description & vbCrLf
        Result = Result & "Error line: " & ASPErr.Line & vbCrLf
        Result = Result & "Client IP: " & Request.ServerVariables ("REMOTE_ADDR") & vbCrLf
        Result = Result & "Client Browser: " & Request.ServerVariables ("HTTP_USER_AGENT") & vbCrLf
        Result = Result & "Client Referer: " & Request.ServerVariables ("HTTP_REFERER") & vbCrLf
        Result = Result & "Path: " & Request.ServerVariables ("PATH_INFO") & vbCrLf
        Result = Result & "Request method: " & Request.ServerVariables ("REQUEST_METHOD") & vbCrLf
        Result = Result & "Request FORM: " & Request.Form & vbCrLf
        Result = Result & "Request QUERY: " & Request.QueryString & vbCrLf
    End If
    MyErrorInfo = Result
End Function    

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...