IIS is really great. But sometimes you get an error message without any clue how to fix it. When I was testing an ASP.NET MVC website on my Windows 7 64-bit machine, I got the following error:
HTTP Error 401.2 – Unauthorized
You are not authorized to view this page due to invalid authentication headers.
After trying to change almost every possible setting in IIS I finally found the root cause of the issue. My default installation of IIS was running without the Windows Authentication module installed. As my website was expecting windows authentication, it was not unexpected to see this error. After enabling this feature in the list Windows Features, everything worked!