IIS 失败请求跟踪不起作用

IIS 失败请求跟踪不起作用

我已经在 IIS 8 上设置了失败请求跟踪,但它没有按预期记录错误;有一个 ASP Classic 页面生成“500 内部服务器错误”,但 FailedReqLogFiles 文件夹为空。这是我的设置:

  • 已安装失败请求跟踪模块

  • 为了跟踪 ASP Classic 页面生成的错误 #500,我设置了以下规则:

<traceFailedRequests>
    <add path="*">
        <traceAreas>
            <add provider="ASP" verbosity="Verbose" />
            <add provider="ISAPI Extension" verbosity="Verbose" />
            <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI,WebSocket,RequestRouting" verbosity="Verbose" />
        </traceAreas>
        <failureDefinitions timeTaken="00:00:00" statusCodes="500-999" />
    </add>
</traceFailedRequests>
  • 由于有 100 多个网站,我enabled="true"在网站默认设置中设置了:
<siteDefaults>
    <traceFailedRequestsLogging enabled="true" directory="%SystemDrive%\inetpub\logs\FailedReqLogFiles" maxLogFiles="50" />
  • 最后我创建了一个抛出错误的测试页面:
<%
Option Explicit
Response.Write a ' Variable is undefined: 'a'
%>

错误按预期记录%SystemDrive%\inetpub\logs\FailedReqLogFiles,但实际内容页面生成的错误则没有记录。这些页面的不同之处在于,它们是通过重写模块调用的,URL 如下所示https://example.com/about.html代替https://example.com/about.asp

如何解决这个问题?

答案1

本文有一张纸条写道:

如果在 URL 重写模块之后安装了失败请求跟踪,则跟踪提供程序中的“重写”区域可能不可用。如果您没有看到“重写”区域列出,请转到添加/删除程序,然后在修复模式下运行 URL 重写模块安装程序。

我重新安装了 URL Rewrite 模块,然后重新创建了失败的请求跟踪规则,确保“WWW 服务器”提供程序的“区域”部分中存在(并选中)“重写”。

失败的请求随后被记录下来,并包含事件查看器中不存在的信息,例如错误页面的完整 URL 和堆栈跟踪

相关内容