This article is a quick guide on how to enable logging of the requests which come into IIS, and trace what happens to them after they've been received.
There are two modules which may need to be added to IIS via the Turn Windows Features on or off applet. HTTP Logging and Tracing.
Pictures and text may vary slightly depending on your operating system or version of IIS.
Once installed - you will probably need to close and reopen the IIS Configuration Window to see some new icons.
Logging
The logging feature simply records all requests sent to the server in a very brief format. This can be useful to quickly see what requests are succeeding and failing on the site. You can choose which columns are included.
2022-11-08 11:50:31 ::1 POST /ActivePublisher16/Controller.aspx elementId=BEDA7AC8BC2D4006BC31E388E2CC7C16&elementType=Processes&modelMasterId= 80 Administrator ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/107.0.0.0+Safari/537.36+Edg/107.0.1418.35 - 200 0 0 343
You can configure some options for this feature if you click on Open Feature.
If you cannot alter the settings, it's possible that the virtual application is selected in the Connections tree, rather than the parent Site.
.log files are produced to the IIS folder. On my computer this resolved as
C:\inetpub\logs\LogFiles\W3SVC1
For more information see Configure Logging in IIS | Microsoft Learn
Tracing
Tracing is a more thorough logging of the actions taken on the request, showing the modules involved with processing the request and response. It can show performance information and authentication information. The icon Failed Request Tracing is a misnomer, it can also log successful requests.
You can access the tracing rules by clicking on Open Feature.
If you cannot alter the settings, it's possible that the virtual application is selected in the Connections tree, rather than the parent Site.
You can then Add your rule.
You can customize what page types or names you want to capture, but here I've chosen everything.
If there's a specific status code you want to capture, you can enter it here, or enter "100-999" to capture everything.
Here you can customize the verbosity - by default everything is verbose and captured.
Press Finish, now requests are captured.
You can limit the number of logged requests via the right-hand Actions bar:
When you make a request, an xml file is produced.
On my computer, this was located at
C:\inetpub\logs\FailedReqLogFiles\W3SVC1
There will probably be a number of XML files, one per request, and an XSL file which prettifies the XML.
You can view these in Internet Explorer.
If you wish to use chrome or edge you can bypass the security issues, via allowing local file access - first you must ensure no chrome or edge process is running in task manager. Then, as an example:
"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --allow-file-access-from-files "file://C:\inetpub\logs\FailedReqLogFiles\W3SVC1\fr000018.xml"
You then have an interactive dashboard to interrogate different aspects of the request.
For more information see Using Failed Request Tracing Rules to Troubleshoot Application Request Routing | Microsoft Learn
See Also
Advanced Logging for IIS - Custom Logging | Microsoft Learn
Comments
0 comments
Please sign in to leave a comment.