IIS 7 and later allow you configuring failed request tracing for a Web site, application, or directory by define tracing rules.

There are two types of rules available:

  • statusCodes
    Specifies the status code(s) you want to trace. You can enter multiple status codes in this list by using commas to separate each code. You can also refine your status codes using sub status codes, such as "404.2, 500" or a range of sub status codes such as "400-599". 
  • timeTaken
    Specifies the maximum time that a request may spend in processing before it is marked as failed and then traced.

For Windows Azure Web Sirtes(WAWS), this feature can be enabled by turn on the "FAILED REQUEST TRACING" on the portal. However, WAWS only trace requests failed with status code rule defined as "400-600". This rule doesn't trace requests take long time, but successed(status code 200). Here is the configuration generated by turn on “FAILED REQUEST TRACING” for WAWS site.

The WAWS defined a trace definition with status code “400-600”, and path=”*”. Here is the default configuration after we enabled the trace on portal.

<tracing>

      <traceFailedRequests>

        <add path="*.aspx">

          <traceAreas>

            <add provider="ASP" verbosity="Verbose" />

            <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />

            <add provider="ISAPI Extension" verbosity="Verbose" />

            <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI" verbosity="Verbose" />

          </traceAreas>

          <failureDefinitions statusCodes="400-600" />

        </add>

      </traceFailedRequests>

</tracing>

 

To trace both failed (status code > 400) and long requests, follow these steps:

  1. Merge follow configuration into your web site's web.config.
  2. On WAWS portal, turn on IIS logging and "FAILED REQUEST TRACING" for your site.

  <system.webServer>
    <tracing>
      <traceFailedRequests>
        <remove path="*" />
        <add path="*">
          <traceAreas>
            <add provider="ASP" verbosity="Verbose" />
            <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
            <add provider="ISAPI Extension" verbosity="Verbose" />
            <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI" verbosity="Verbose" />
          </traceAreas>
          <failureDefinitions timeTaken="00:00:10" statusCodes="400-999" />
        </add>
      </traceFailedRequests>
    </tracing>
  </system.webServer>
 

With this change, follow requests will be traced:

  • Requests took longer than 10 seconds in IIS pipeline.
  • Status code is larger than 400.

Here is a sample for long request, this indicates there is a delay in the Page_Load.

-       The failure reason is TIME_TAKEN.

 

-       The page started at 1:57:55.045

 

 

 

-       Entered the Page_Load at 1:57:55.827

 

-      

Conclusion: Page_Load spent more than 10 seconds.

 

Regards,

Wei Zhao from APGC DSI Team