1

I have an ASP.NET MVC application running on IIS 7.5 using windows authentication. For every request in the IIS logs, I see a 401 with no username and a 200 with a username.

Is there something I can configure to avoid getting these extraneous 401s in the logs? Could this be impacting performance?

1

1 Answer 1

1

Paul,

This is normal behavior for IIS. You are seeing a 401 because the first request from a user comes in unauthenticated, IIS then responds back and says the request was not authorized (hence the 401) and then tells the client what options they have to authenticate. These 401's are not really extraneous, they are a fact of the HTTP request/response process when authentication is required.

What you can do is use IIS's Advanced Logging to filter out the 401's in another log file. The problem with this that this would filter all 401's. IIS.NET has a good article that explains how to create a filtered log. Advanced Logging has a lot of other features that may also interest you if you are wanting to customize what kind of things get logged.

Nevertheless, your default IIS log will still contain every request...even the 401's.

1
  • do you know how to prevent IIS from responding with 401 to un-authenticated request before receiving the whole request's body? I see that it responds right after getting the HTTP headers, and this creates problems with our load balancer (FortiGate). Thanks!
    – Cat Mucius
    Dec 13, 2018 at 10:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .