OverviewFailed Request Tracing Rules is a powerful tool for troubleshooting request-processing failures in IIS 7.0. This topic leads the reader through the steps to enable Failed Request Tracing Rules to debug failures and trace steps in Application Request Routing. For more information about Failed Request Tracing Rules, refer to this article.
GoalTo configure Failed Request Tracing Rules and to understand what to look for when troubleshooting Application Request Routing.
PrerequisitesThis walkthrough requires the following prerequisites:
- IIS 7.0 on Windows 2008 (any SKU) or newer with Tracing role service installed for IIS.
- Microsoft Application Request Routing Version 1 and dependent modules.
- Minimum of two application servers with working sites and applications.
- Download Microsoft Application Request Routing Version 1 for IIS 7 (x86) here.
- Download Microsoft Application Request Routing Version 1 for IIS 7 (x64) here.
Another prerequisite is that the reader has gone through the other walkthroughs and has configured Application Request Routing. Application Request Routing should be in working order before proceeding with this walkthrough.
Step 1 – Configure Failed Request Tracing RulesIn this step, the Failed Request Tracing Rules are defined for Application Request Routing.
To configure Failed Request Tracing Rules using the UI:
1. Launch IIS Manager (inetmgr).
2. Select the Default Web Site.
3. In the Actions pane, under Configure, select Failed Request Tracing….
4. In the Edit Web Site Failed Request Tracing Settings dialog box, check the Enable checkbox.
5. Click OK to save changes.
6. Select the Default Web Site.
7. Double-click Failed Request Tracing Rules.
8. In the Actions pane, click Add….
Select All content (*), and then click Next.
9. Select Status code(s): and enter 200-399.
Click Next. The above configuration has created a Failed Request Tracing Rule that writes traces when the status code falls between 200 and 399.
10. Deselect ASP, ASPNET, and ISAPI Extension. After selecting WWW Server, deselect everything under Areas:, except for Rewrite and RequestRouting. Since Application Request Routing relies on the URL Rewrite Module to inspect incoming requests, it is recommended that you enable the traces for both Application Request Routing (RequestRouting) and URL Rewrite Module (Rewrite).
For additional information about URL Rewrite Module traces, refer to http://learn.iis.net/page.aspx/467/using-failed-request-tracing-to-trace-rewrite-rules/.
11. Click Finish.
To configure Failed Request Tracing Rules using the command-line:
1. Open a command prompt with administrator privileges.
2. Navigate to %windir%\system32\inetsrv.
3. To enable Failed Request Tracing on the Default Web Site, enter: appcmd set site "Default Web Site" -traceFailedRequestsLogging.enabled:"true" /commit:apphost.
4. To configure the Failed Request Tracing Rules as shown in the UI above, enter:
- 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,RequestRouting',verbosity='Verbose']"
- appcmd.exe set config "Default Web Site" -section:system.webServer/tracing/traceFailedRequests /[path='*'].failureDefinitions.statusCodes:"200-399"
Step 2 – Analyze Failed Request Tracing LogsIn this step, you will send requests to Application Request Routing and analyze Failed Request Tracing logs.
To view Failed Request Tracing logs:
1. Navigate to the directory where the Failed Request Tracing logs are written. By default, the location is %SystemDrive%\inetpub\Logs\FailedReqLogFiles\.
2. Change directory to the folder that matches the Default Web Site. By default, this is W3SVC1. If you are unsure, select the Default Web Site in IIS Manager, and then select Advanced Settings… in the Actions pane. The value of the ID indicates the corresponding folder. (ie. ID 1 corresponds to W3SVC1).
3. If there are any xml files, remove them by typing:
4. Send a request to Application Request Routing. If Application Request Routing is functioning correctly, it results in a 200 response, which falls within the 200 to 399 range that was specified in Step 1. Therefore, the logs are written to the location above.
5. List the files in the directory to confirm that new xml files are written.
6. Open the xml file. Click Request Details. Select Complete Request Trace, and then click Expand All. Below is an example of a Failed Request Tracing log for Application Request Routing:
7. Pay closer attention to the following sections:
- Headers: Shows the HTTP header that Application Request Routing has received.
- WebFarm: Indicates the name of the server group to where the request is routed.
- Server: Indicates the destination server to where the request is routed.
- Algorithm: Indicates which load balance algorithm is used.
- RoutingReason: Indicates the decision behind why the server is selected.
- State: Availability of the destination server.
- TotalRequests: Runtime statistic on how many requests have been sent to this server.
- CurrentRequests: Runtime statistic on the concurrent number of HTTP requests to this server.
- BytesSent: Runtime statistic on how much data in KB have been sent to this server.
- BytesReceived: Runtime statistic on how much data in KB have been received from this server.
- ResponseTime: Runtime statistic on the responsiveness in ms of this server.
- Headers: Shows the response HTTP header from the destination server.
- Buffer: Shows the response entity from the destination server.
- The following have been added with the timestamps to indicate the
start and end times of corresponding events to profile the performance
of Application Request Routing: