iis-7 - 带有 IIS 日志的内部服务器错误 500

标签 iis-7 asp-classic internal-server-error

我的经典 asp 网站出现一些错误。当网站第一次运行时,它有时会出现内部服务器错误。然后刷新将修复它。我决定检查我的 IIS 日志以查看问题所在,但我无法解释它。这是日志行

  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

最佳答案

如何设置自定义页面来处理 500 和 500 100 错误?

  1. 创建一些文件夹,比如说 D:\InetPub\Web01\Err\ 添加具有写入权限的 IUSR_Web01 用户

  2. 在 Web01 网站的 IIS 中(IIS 6.0 示例) enter image description here

  3. 在文件500.asp 和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:\InetPub\1click.lv\Err\500 " & "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
    

函数:

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    

关于iis-7 - 带有 IIS 日志的内部服务器错误 500,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20475502/

相关文章:

c# - 回发时出现无效 View 状态错误

asp.net - IIS7集成管道: Interaction between maxConcurrentRequestsPerCPU and requestsQueueLimit settings

jquery - 从经典 ASP 调用 .Net 代码的最简单方法?

php - 使用 php 在 gzopen 中解压缩大型 gzip 文件的缓冲区大小是多少?

laravel - 错误 : Request failed with status code 500 Laravel/Vue

c# - 从 ASP.NET Web 应用程序运行 .exe 的权限问题

asp.net - iis 7.0,模块顺序更改

asp.net - 我应该开始学习经典的 VB/ASP 还是 .NET?

vbscript - CDO.消息 - "The transport failed to connect to the server."

c# - WWW POST 给我内部服务器错误