I just had one of those wonderful days where everything in Windows just falls apart. I set out yesterday morning to finally install ASP.NET 5 Beta 8. One of the installs along the way is the Visual Studio Web Tools Update for Beta 8. Ok, so I installed that and towards the end of that install the machine blue screens with a REGISTRY_ERROR.
Ok, so after the reboot I tried again - same bloody thing: Full Windows Blue screen. Aaargh.
So I figured I'll check in Visual Studio and sure enough it appears the install actually worked. I can see the Beta 8 tools installed in the VS About screen. Except - it really isn't all there. Visual Studio started throwing all sorts of package load errors. Hrrmph. I knew what was coming next - uninstalling and reinstalling Visual Studio.
Except - that Visual Studio would now not uninstall. It'd start uninstalling and then just hang half way through the uninstall would hang. Lovely. So then came a long string of Repair, Uninstall, Reinstall - all yielding slightly different and equally unsatisfactory results. I was eventually able to uninstall and reinstall Visual Studio, but still have major packages failing to install. I still don't have a stable Visual Studio 2015 install at this point.
But it gets worse.
IIS Configuration Corruption
I also started having major issues with IIS. IIS now would run static content just fine but all ASP.NET content would either throw an auth dialog or show with a nice fat 401.2 error page when only Anonymous access was enabled:
Aargh. Nothing I initially tried - checking disk permissions, using different anonymous accounts, disabling security entirely with mode=none - would work.
Corrupted and/or Missing master web.config File
After a bit of sleuthing I found that the .NET master web.config file got completed corrupted - containing binary data. No wonder things were not working. I copied out a new web.config from web.config.default in the .NET framework folders and thought that would fix it. Except it didn't.
Even though I had copied in a new web.config, after going back and checking I could see that the web.config had disappeared again. And that missing web.config file was the culprit all along: After hours of poking around in the IIS settings (and I consider myself rather adept at knowing IIS settings like the back of my hand) I finally found when I looked at the .NET Trust levels at the Machine root, the .NET Trust Levels were missing:
which was the dead givaway that something was very wrong. The fix in my case was to copy the web.config.default to web.config and voila everything snapped back to working.
These values are defined in the .NET master configuration web.config file which lives in:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config
C:\Windows\Microsofyt.NET\Framework64\v4.0.30319\Config\web.config
Not surprisingly the 32 bit file was the one that had been corrupted previously and caused the initial havoc I had seen. Oddly the web.config in these folders simply were not there. Gone, missing and with it the base ASP.NET configuration which caused all sorts of problems. Once I replaced those with the default files, things started working the way they should.
A Reinstall Didn't Fix it!
But here's the real WTF: Prior to this discovery I had completely uninstalled IIS and renamed the windows\system32\INETSVR folder to force IIS to reinstall itself from scratch as it did. It created a new inetsvr folder but it did not install web.config files in the above config folders. Even after a full uninstall/reinstall I still saw the same failure of a continues login dialog or a 401.2 error. WTF???
I still had to manually copy the web.config.default to web.config in order for those settings to get picked up. For a sanity check I went over to my live Web Server and double checked and sure enough there's a web.config file in the Framework\Config folder. But on this machine even a complete reinstall didn't create one for me.
That's now solved my IIS problem. I still don't have a working copy of Visual Studio, but I'll leave that for another post once I figure out what the heck the problem is with that.
Other Posts you might also like