How to Diagnose IIS Errors Without Exposing Server Details

An HTTP 500 page tells the caller that the request failed, but it may hide the cause. Diagnose the failing request on the server and keep the public response controlled. The old /IISHelp/common/500-100.asp error-page recipe is not needed on IIS 10.

Establish the exact failure

Reproduce the request once and record its URL, time, status and IIS substatus. Find the matching W3C log entry. If the error originates before the application runs, its exception logger may have nothing to record.

In an elevated Windows PowerShell session, inspect the error policy for the test application:

PowerShell
$appcmd = Join-Path $env:windir 'System32\inetsrv\appcmd.exe'
$appPath = 'Default Web Site/Demo'
& $appcmd list config $appPath /section:system.webServer/httpErrors

If local detailed errors are appropriate, set and read back that exact policy:

PowerShell
& $appcmd set config $appPath /section:system.webServer/httpErrors /errorMode:DetailedLocalOnly /commit:apphost
if ($LASTEXITCODE -ne 0) { throw 'Error policy was not saved.' }
& $appcmd list config $appPath /section:system.webServer/httpErrors

The expected readback is errorMode="DetailedLocalOnly". Test both a local request and a genuinely remote request to an intentionally failing test endpoint. The latter must not expose physical paths, connection details or stack traces. Remove the test endpoint afterward.

Trace one failure when the response is insufficient

If the IIS Tracing role service is installed, enable Failed Request Tracing for the selected site and add a rule for the observed status. Reproduce once, inspect the resulting trace and identify the module and notification that set the error. Bound the number of retained files and disable the temporary rule when finished.

Application frameworks and Classic ASP have their own error-output controls. IIS httpErrors is not a universal switch for every exception page. Also consider how a local reverse proxy affects locality. Locality at IIS may not equal locality of the original visitor. Verify the externally served response instead of relying only on the setting's name.

References

HTTP Errors <httpErrors>
Overview The <httpErrors> element allows you to configure custom error messages for your Web site or application. Custom error messages let you provide...
https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/
HTTP errors configuration
Troubleshoot 4xx and 5xx HTTP Errors in IIS - Internet Information Services
Provides troubleshooting steps for resolving 4xx and 5xx HTTP status code errors in Internet Information Services (IIS).
https://learn.microsoft.com/en-us/troubleshoot/developer/webapps/iis/site-behavior-performance/troubleshoot-http-error-code
Troubleshoot IIS HTTP errors

Author: Herman Schoenfeld