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…)
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:
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.