Reputation: 4432
Everything was working just fine...then one time running the debugger and I'm given a 401.2 error from IIS Express 7.5. I created a new project and tested - worked fine. I ensured the web.config and other project settings where identical - still getting the error in the original project!
(I actually resolved this issue...but haven't seen documentation for this exact issue with my resolution anywhere, I'll add the answer momentarily...Yes, I already reviewed other 401.2 questions on Stackoverflow (and elsewhere) and they are not the same as the issue I was facing...)
Upvotes: 1
Views: 407
Reputation: 1
Enable AnonymousAuthentication on the web project... See these instructions for enabling WindowsAuthentication EXCEPT in the same place you can enable AnonymousAuthentication: IIS Express Windows Authentication
In VS2011, debugging my MVC project was working until this setting mysteriously changed to "Disabled" and I began receiving 401.2 error. Enabling this setting fixed the problem.
Upvotes: 0
Reputation: 4432
In my case, for some reason VS 2011 added a few lines to my applicationhost.config file located under Documents\IISExpress\config. The lines added (and which I removed) where as follows:
<location path="IRFEmpty">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>
</location>
Don't ask me how they got there - I didn't add them. It is pretty annoying, since all the code in my VS project was 100% correct, it was the IISExpress configuration wrong.
Upvotes: 4