Using IIS ManagerTo start the confi guration Failed Request Tracing Rules, you use IIS Manager to enable Failed Request Tracing for a given Web application.. Although you can defi ne rul
Trang 1Using IIS Manager
To start the confi guration Failed Request Tracing Rules, you use IIS Manager to enable Failed
Request Tracing for a given Web application Although you can defi ne rules by virtual directory
or by Web application level, the failed request tracing feature must be enabled at the site level
fi rst:
1 Using IIS Manager, navigate down to your target Web site
2 Click Failed Request Tracing Rules and then click the Open Feature in the Actions
pane
3 Click Edit Site Tracing … from the Actions pane
4 Check the Enable check box
5 Defi ne the directory location where all failed request fi les will be stored and the maximum number of log fi les you’d like maintained
6 Click the OK button
Centralized Tracing for ASP.NET and IIS 7.0
Following the theme of integrating ASP.NET and IIS 7.0, tracing information is now aggregated
into the same pipeline In addition to the integration is the theme of extensibility, which
allows Web developers to add their own tracing information into that same pipeline This gives
administrators and developers a single fi le that defi nes all the tracing information for all
components that interact within a given request This capability is not only great for testing
purposes during a development phase, but it also provides a wealth of information while you’re
working on issues in production
Let’s fi rst take a look at a simple scenario where an ASP.NET developer can plug into the IIS 7.0
tracing infrastructure Create a simple aspx page with the following code and save it as simpletrace.aspx:
<%@ Page language=“C#” trace=“true” %>
<%
Trace.Write(“HowToCheatIIS7- Chapter 6: Interesting Info”);
Trace.Warn(“HowToCheatIIS7- Chapter 6: Issue”);
Response.Write(“hello, world”);
%>
If you now browse to this page, you’ll see a wealth of information at the bottom of the page
(see Figures 17.8 and 17.9) It also includes the tracing information we defi ned within the Tracing
Information section
Trang 2Figure 17.8 Hello, World’s Trace Information
Figure 17.9 Hello Word Information
Trang 3There is nothing new here to experienced ASP.NET developers That’s actually the cool part!
Although this tool was available in ASP.NET before IIS 7.0, it only maintained information from
ASP.NET With the @Page declaration having the trace attribute set to true, we will still only
see ASP.NET-based information on this page
Now it’s time to see the centralized view of ASP.NET and IIS information in action To do this, you must defi ne the kind of information you want the Failed Request Tracing Rules to capture and store for you:
1 Using IIS Manager, navigate down to your target Web application
2 Click Failed Request Tracing Rules and then click the Open Feature in the Actions
pane
3 From the Actions pane, click the Add…link.
4 From the Specify Content to Trace page, select ASP.NET (*.aspx) and click Next.
5 From the Defi ne Trace Conditions page, check the Status Codes check box and enter 200
as the status code
6 From the Select Trace Providers page, select only the following options:
■ Providers: ASPNET
■ Verbosity: Verbose
■ Areas: Page
7 Click Finish
You’ll now see the rule shown in Figure 17.10 in the Failed Request Tracing Rules page
Trang 4Using your browser, navigate back to the simpletrace.aspx page You should see the same result But now we need to look at the trace fi le that was produced by IIS 7.0:
1 Click the Windows button and click Computer.
2 Navigate to the folder where the defi ned Failed Tracing Rules should be stored The default location is %SystemDrive%\inetpub\logs\FailedReqLogFiles\W3SVC1\
Here you should see all the failed request fi les for this site The format is in FR######.xml, where ###### is a number which increments with each new failed request being created If you use
a program like Notepad to open the contents of one of the failed request fi les, you’ll notice that the fi le
is actually just XML (the fi le extension points that out as well) By having the results stored in an XML format, Microsoft has opened up the possibilities of what can be done with this data—including pulling the data periodically from the local folder and storing it in a rich database such as SQL Server 2005! There is also a fi le named freb.xsl that is an XML style sheet used to give the failed requests a nice look and feel when you open a failed request fi le using Internet Explorer In fact, Figure 17.11 shows the failed request fi le for our previous request using Internet Explorer
Figure 17.10 A Failed Request Rule
Trang 5Microsoft is continuing to invest in the IIS 7.0 platform and embedding those changes
in the server version of IIS 7.0, which will ship as part of Windows Server 2008 One
such improvement is an updated style sheet for the Failed Request Tracing fi les
The past style sheet (Windows Vista) was great in terms of providing a more pleasant viewing experience of the FRT fi le versus a straight Notepad view of the XML, but it still required the user to hunt through the entire contents to fi nd any warnings or failures
The new version of the style sheet (Windows Server 2008) will provide a simplifi ed view
of the trace fi le and focus on the warnings and failures within the contents However,
the user can still expand the views to see the entire contents The goal was to reduce the amount of data users have to sift through each time they look at a Failed Request Trace
As with the version of IIS 7.0 that ships with Windows Vista, the Windows Server
2008 version of IIS 7.0 will continue to provide all the rich tracing information in the same XML format
With the release of Windows Server 2008, administrators will be able to store the FRT fi les on a remote share via a UNC path At the time of this writing, Windows
Server 2008 has yet to ship, so these features could change or could be cut in the
fi nal release of the product
Figure 17.11 A Failed Request File