Configure failed request tracing

The following steps are applicable on IIS 7.0 or higher.

The following steps describe how to configure the Failed Request Tracing.

Click on the link below to expand the section to configure the Failed Request Tracing using appcmd.exe command.

Enable and configure Failed Request Tracing
appcmd.exe set config -section:system.applicationHost/sites "/[name='Default Web Site'].traceFailedRequestsLogging.enabled:True" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites "/[name='Default Web Site'].traceFailedRequestsLogging.maxLogFiles:10" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites "/[name='Default Web Site']\inetpub\logs\FailedReqLogFiles" /commit:apphost
appcmd.exe set config "Default Web Site" -section:system.webServer/tracing/traceFailedRequests /+"[path='*']"
appcmd.exe set config "Default Web Site" -section:system.webServer/tracing/traceFailedRequests /+"[path='*'].traceAreas.[provider='WWW Server',areas='Rewrite',verbosity='Verbose']"
appcmd.exe set config "Default Web Site" -section:system.webServer/tracing/traceFailedRequests /[path='*'].failureDefinitions.statusCodes:"400-599"
  1. Open IIS Manager, expand the root node, expand Sites and then select Default Web Sites.
  2. In Actions pane on the right, select Failed Requests Tracing....
  3. Select the Enable check box and then click OK. The Directory target and the Maximum number of trace files can be modified.
  4. Expand Default Web Site and select the Web site to be traced.
  5. Double click on the Failed Request Tracing Rules icon of the selected Web Site.
  6. In the Actions pane on the right, click on Add... to add a new rule.
  7. Select All content (*) and click Next.
  8. Select the Status Code(s) check box. Enter the type of the status code to be traced, in this case type in the Status code(s) is set to monitor everything between code 200 to 599. Set the appropriate status code and click Next.
  9. The last setting is to select the providers of the tracing. Select WWW Server. For each of them, set the Verbosity to Verbose. Finally, check Rewrite and click Finish.
  10. The tracing rule is now defined.