Debug and troubleshoot rewrite rules easily

One of the very cool features of URL Rewrite Module is its integration with IIS Failed Request Tracing. When you have rewrite rules that do not work the way you expect them to work – enable Failed Request Tracing and you will get the entire history of how rewrite rules were applied on the requested URL. I use Failed Request Tracing all the time and it has proven to be a great help when debugging and troubleshooting rewrite rules.

When you enable Failed Request Tracing and make an HTTP request that you want to trace, IIS creates a trace log file frNNNNNN.xml located by default at %WINDIR%\inetpub\logs\FailedReqLogFiles\W3SVCN. This xml file references freb.xsl file that is used to render the trace data in a web browser in a human-friendly form:

FREB1

When the trace file is rendered in a web browser the URL Rewrite trace events are mixed together with all other IIS events. If trace file is very verbose it may take you some time to locate URL Rewrite specific events. Would not it be nice if there was an easier way of locating the URL Rewrite trace events other than scanning through the log file?

There is a relatively easy way to fix that. Use the link below to download the updated version of freb.xsl file and then put it into the directory where trace files are located (usually in %WINDIR%\inetpub\logs\FailedReqLogFiles\W3SVC<siteid>\). Overwrite the old freb.xsl file which was placed there by IIS. After you’ve done this, if you open any of the trace files, you will be able to easily locate all URL Rewrite specific events:

FREB2

Download the freb.xsl file here:

FREB Stylesheet for URL Rewriter (14.74 KB)

25,163 views

ruslany on October 29th 2008 in URLRewrite

PoorFairAverageGoodExcellent (2 votes, average: 3.00 out of 5)

4 Responses to “Debug and troubleshoot rewrite rules easily”

  1. Gravatar ImageBill Staples responded on 30 Oct 2008 at 1:12 pm #

    You’re sneaky extended FREB’s xslt like that! :)

  2. Gravatar ImageLaszlo responded on 10 Sep 2009 at 5:46 am #

    I found that – as its name implies – Failed Request Tracking tracks only failed requests. That is, if URL rewrite does not work as expected, but the reqauest is not failed, nothing is traced.

    So how can I debug it then ?

  3. Gravatar Imageruslany responded on 10 Sep 2009 at 5:07 pm #

    Laszlo, it is possible to use Failed Request Tracing even for the successful requests (that is the requests that result in HTTP 200 response). Did you follow the instructions from this article when you set up the tracing?

  4. Gravatar ImageDani Rodríguez responded on 06 Feb 2012 at 7:12 am #

    Thanks!

Trackback URI | Comments RSS

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

XML Markup: If You want to add XML code to the comment please XML encode it first, otherwise the code will not show up.

Recently Published Articles