皮特28论坛

标题: Troubleshooting Failed Requests Using Tracing in IIS 7 [打印本页]

作者: 二打炉    时间: 2017-12-22 20:02
标题: Troubleshooting Failed Requests Using Tracing in IIS 7
  by IIS Team
Introduction
  Request-based tracing is available both in stand-alone IIS Servers and on Azure wep apps and provides a way to determine what exactly is happening with your requests and why, provided that you can reproduce the problem that you are experiencing. Problems like poor performance on some requests, or authentication-related failures on other requests, or the server 500 error from ASP or ASP.NET can often be difficult to troubleshoot--unless you have captured the trace of the problem when it occurs. the following article discusses failed request tracing on IIS Server. For information about doing this with Azure web apps click here
  Failed-request tracing is designed to buffer the trace events for a request and only flush them to disk if the request "fails," where you provide the definition of "failure". If you want to know why you're getting 404.2 error messages or request start hanging, use failed-request tracing.
  The tasks that are illustrated in this article include:
Prerequisites
Install IIS
  You must install IIS 7 or above before you can perform the tasks in this article. Browse to http://localhost/ to see if IIS is installed. If IIS is not installed, see Installing IIS on Windows Server 2008 for installation instructions. When installing IIS, make sure that you also install the following:
Log In as Administrator
  Ensure that the account that you use to log in is the administrator account or is in the Administrators group.
  Note
  Being in the Administrators group does not grant you complete administrator user rights by default. You must run applications as Administrator, which you can do by right-clicking on the application icon and selecting Run as administrator.
Make a Backup
  You must make a backup of the configuration before doing the following tasks.
  To make a backup of the configuration:
Create Sample Content
Disable ASP
  ASP must be disabled for this task. ASP is disabled only as an example and for the purposes of the tasks in this article.
  To disable ASP:
Enable Failed-Request Tracing
  After you enable failed-request tracing, you need to configure where the log files will reside. In this task, you will enable failed-request tracing for the Default Web Site and specify where to put the log files. You will then configure the failure for which to generate failure logs.
Step 1 : Enable Failed-Request Tracing for the Site and Configure the Log File Directory
  Failed-request tracing logging is now enabled for the Default Web Site. Check the %windir%\system32\inetsrv\config\applicationHost.config file to confirm that the configuration looks as follows:
  
  

    
  
  
  
  
Step 2 : Configure Your Failure Definitions
  In this step, you will configure the failure definitions for your URL, including what areas to trace. You will troubleshoot a 404.2 that is returned by IIS for any requests to extensions that have not yet been enabled. This will help you determine which particular extensions you will need to enable.
  IIS Manager writes the configuration to the %windir%\system32\inetsrv\config\applicationHost.config file by using a  tag. The configuration should look as follows:
  
  
  
  
  
  
  
  
  
  
  
  
  
Test and View the Failure Request Log File
  In this task, you will generate a failed request and view the resulting trace log. You already configured IIS to capture trace logs for http://localhost/*.asp requests that fail with an HTTP response code of 404.2. Now verify that it works.
Step 1 : Generate an Error and the Failure Request Log File
Step 2 : View the Failure Request Log File
Summary
  You have completed two tasks: configured failed request tracing to capture traces for *** if IIS returns it with a 404.2 status code; and verified that IIS captured the trace for your request. You also verified that the freb*.xml log file did not contain any other requests for the requests that you made because the requests did not have a 404.2 return code. When you consult the failure log file, you determined that the cause of the failure was that the extension was disabled for that request. You can try other non-HTML pages (like gifs or jpgs) and note that the log file does NOT add these traces. You can also easily change this to be 404, or capture the failure if the request takes longer than 30 seconds by setting the timeTaken field in your failureDefinitions.
Restore Your Backup
  Now that you have completed the tasks in this article, you can restore the backup of the configuration. Run the following command with administrator user rights:
%windir%\system32\inetsrv\appcmd restore backup cleanInstall






欢迎光临 皮特28论坛 (http://pit28.com/) Powered by Discuz! X3.2