Search code examples
.netloggingiis-10

IIS Logs not capturing all requests


I am trying to find a way to associate IIS logs with logs that are generated within my .NET API code. What I am finding, however, is the IIS logs do not seem to capture every incoming request. I did a stress test of my API, which made roughly 12000 requests to the API hosted in IIS, but the IIS logs only seemed to capture around 800 of them.

I have not been able to find anyone else with a similar problem, so I am wondering if I am doing something wrong or am I just expecting too much out of IIS logging?

Any commentary on my original goal of associating IIS logs with my api logs is welcome, as that isn't going well either.


Solution

  • IIS logs requests after they have completed. W3WP.exe logs to memory after the response has been sent to the client. Then at regular intervals W3Wp.exe writes to the IIS log file specified in the Website configuration. You may have to wait several seconds before requests are visible in the IIS log file. I believe that HTTP.sys is written to in realtime. If you don't see your requests in the IIS log file, check that you are indeed visiting the website you think you are. You can also check the most recent %systemroot%\System32\LogFiles\HTTPERR log file for your request, if IIS can't handle your request, HTTP.sys will log why IIS could not accept the request. Hope this can help you.