IIS error logs: where to find them and how to read them
IIS spreads its errors across several places: the site (W3C) logs, the HTTPERR logs written by HTTP.sys, Failed Request Tracing files, and the Windows Application event log. If an error is missing from the site log, check HTTPERR first. If you have a status code but no explanation, turn on Failed Request Tracing.
On this page
What it means
People often go looking for "the" IIS error log and cannot find it, because there isn't one. Different components write different logs, and which one holds your error depends on where the request failed.
The site logs record every request that reached IIS, including its status code. For the reason behind a particular status code you need Failed Request Tracing, and for application crashes behind a 500, the Windows Application event log.
This page is about finding and reading those logs. For ASP.NET and ASP.NET Core 500 errors, the event log and ASP.NET Core Module logs below are the starting point.
Symptoms and causes
You are likely dealing with this problem if:
- A user sees a 4xx or 5xx error, but nothing matching appears in the site log.
- The log folder is empty or missing.
- Failed Request Tracing is enabled but no files are produced.
- The site log shows a bare 500 with no explanation.
The usual causes, most common first:
- Looking in the wrong log
- Logging can be configured per site with a different directory.
- Status code known, source unknown
- The site log tells you the code but not which module or handler produced it. Failed Request Tracing shows that.
- Tracing role service not installed
- Without the Tracing role service, Failed Request Tracing rules do nothing.
- Log folder missing or not writable
- ASP.NET Core Module debug logs and stdout logs both need an existing folder the app pool identity can write to.
- 500 details are in the event log
- For ASP.NET and ASP.NET Core, the real error is often in the Application event log, not in IIS logs.
- Detailed errors only shown locally
- By default, detailed error pages appear only for local requests, so remote users see a generic page.
- Logging sent to ETW only
- On Windows Server 2012 R2 and later, the Log Event Destination can be set to ETW only, so no log file is written.
How to fix it
Work through these in order. They start with the quickest, safest checks and move to deeper repairs; stop as soon as the problem is gone.
1.Find the site (W3C) logs
These cover every request that reached IIS, with the status code and sub-status.
- Open IIS Manager, select the site (or the server), and open Logging. The Directory field shows where logs go. You can also click View Log Files in the Actions pane.
- The default base location is below, but per-site settings override server-level defaults, so always trust the Directory field. The site ID is shown in the ID column of the Sites list.
%SystemDrive%\inetpub\logs\LogFiles - Check the One log file per setting (Site or Server) and, on Server 2012 R2 and later, Log Event Destination. If it is ETW only, no file is written.
- Open the newest file in that folder and read
sc-status,sc-substatusandsc-win32-statusfor the failing request.
2.Check the HTTPERR logs
Requests rejected by HTTP.sys before IIS saw them are logged here.
- Open the default folder.
C:\Windows\System32\LogFiles\HTTPERR - If the folder is empty, check whether an admin moved it: look at the registry value
ErrorLoggingDirunder the key below. If the value is absent, the default applies.HKLM\System\CurrentControlSet\Services\HTTP\Parameters - Read the
s-reasonfield of the matching entry and look it up in Microsoft's "Types of Errors Logged by the HTTP Server API" documentation. - To confirm HTTP.sys sent a response, look for the response header
Microsoft-HttpApi/2.0, for example in a browser HAR capture.
3.Read the Application event log for 500 errors
ASP.NET Core Module records startup and crash details here when an app returns a 500.
- Open Event Viewer and go to Windows Logs > Application.
- Look for entries from the source IIS AspNetCore Module or IIS Express AspNetCore Module around the time of the error.
4.Show detailed errors temporarily
Detailed errors are shown only to local requests by default. Enabling them for remote users can reveal the real message.
Before you start: Use this only on a test server and revert it afterwards. Detailed errors can leak sensitive information to visitors.
- In IIS Manager, select the site and open Error Pages.
- Click Edit Feature Settings in the Actions pane and choose Detailed errors.
- Reproduce the error, then set the option back.
5.Turn on the ASP.NET Core stdout log
When an ASP.NET Core app fails to start, its console output can show the reason.
Before you start: This is a troubleshooting setting. Turn stdout logging off again when finished so log files do not keep piling up.
- In the app's
web.config, setstdoutLogEnabledto true on theaspNetCoreelement and pointstdoutLogFileat a folder.<aspNetCore ... stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout"> - Create the
logsfolder and give the app pool identity write permission to it. - Restart the app and open the files named
stdout_<timestamp>_<PID>.log. - Set
stdoutLogEnabledback to false.
6.Enable the ASP.NET Core Module debug log
Gives module-level detail when the stdout log is not enough.
Before you start: Back up web.config first and remove the setting after troubleshooting.
- Add this inside the
aspNetCoreelement ofweb.config.<handlerSettings> <handlerSetting name="debugLevel" value="file" /> <handlerSetting name="debugFile" value="c:\temp\ancm.log" /> </handlerSettings> - Make sure the folder in
debugFileexists and the app pool identity can write to it, then reproduce the error and open the log.
7.Use Failed Request Tracing (FREB)
Shows which module or handler produced a specific status code, which the site log cannot tell you.
Before you start: Verbose tracing of all content produces many files. Narrow the rule once you know the status code, and disable tracing when done.
- Install the Tracing role service: Server Manager > Add Roles and Features > Web Server (IIS) > Web Server > Health and Diagnostics > Tracing.
- Open the site, then Failed Request Tracing Rules > Add. Choose All content, set the status codes to
400-600, select all providers and areas, and set verbosity to Verbose. - Select the site, click Configure > Failed Request Tracing in the Actions pane and tick Enable. Set the directory to
%SystemDrive%\inetpub\logs\FailedReqLogFilesand maximum trace files to 1000. - Reproduce the error. One XML file per failed request appears under
...\FailedReqLogFiles\W3SVC<id>\.
Check that it worked
- The failing request now shows up in one of the logs above, with a status code and reason you can act on.
- Temporary settings (detailed errors, stdout logging, debug logging, verbose tracing) are switched back off.
If it still fails
- For a hard 500 or a hanging w3wp process, Microsoft's troubleshooting page describes capturing a dump with ProcDump and analysing it with DebugDiag 2. Use this only for hangs or crashes, not for ordinary log reading.
- For 503 errors, compare
s-reasonin HTTPERR withsc-substatusin the site log, as described on Microsoft's troubleshooting page.
Questions
Do old IIS logs delete themselves?
The sources used for this page do not cover log retention, so check your own configuration and clean old files deliberately.
Sources
- Troubleshoot 4xx and 5xx HTTP Errors in IISOfficial · Microsoft Learn
- Logging (IIS feature page, Windows Server 2012 R2/2012, archived)Official · Microsoft Learn