How to configure IIS 7 so it creates a Windows event every time an HTTP error occurs?
The closest thing I found is this: https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms524984(v%3Dvs.90). It describes two configuration variables AspErrorsToNTLog
and AspLogErrorRequests
. However I cannot force IIS to create events for HTTP errors. And I am not even sure if these are applicable, as the documentation mentions only ASP errors and not HTTP errors.
AspErrorsToNTLog
When set to TRUE, this property specifies that ASP errors are logged to both the Event Viewer and to the IIS log file.
When set to FALSE, this property specifies that ASP errors are logged only to the IIS log file.
The logging to file works properly. In c:\inetpub\logs\LogFiles\...\u_ex200123.log
, we have the expected lines like this (notice the 500
near the end of the line)
2020-01-23 05:38:06 ip-address GET /MyService/ param1=value1¶m2=value2|-|ASP_0146|New_Session_Failed 80 - ip-address - 500 0 0 545
To avoid the X-Y problem: We'd like to use it to trigger an action (such as sending an email to Operations) when some of the web services return HTTP status 500.