Monday, 11 November 2013

IE11 - how to fix if you develop in IIS locally

When testing a site I usually develop in Visual Studio then test in IIS on the local machine rather than the built in web server in Visual Studio. Mainly because I tend to find it quicker, once set up I don't necessarily need VS open if I just want to show a site to a customer or I might want to muck around with IIS settings for a site which has a specific setup.

Anyway, IE11 breaks this setup and prevents me from viewing my sites in it due to some security thing which I don't really understand but there we go. Here is how to resolve! Try and go to the local site where it will complain about your connection, then click on Settings>Internet Options>Security>Local intranet then click on Sites and add the site (woohoo, I have to do this for the 50 or so sites I have setup locally...).

I then went to test the site which uses some nice CSS 3 effects and things like that but none of them showed up. I tried a lot of things, viewed other sites, then previewed the same file locally and on a remote server and they showed up differently... This irked me somewhat then found the shiny new Settings>Compatibility View Settings window, here I could then uncheck 'Display intranet sites in Compatibility View' which was checked by default.

I'm also reasonably upset that they've removed the previewing in another version from the developer tools. I understand why they've done this but it is a massive headache requires running a lot of VMs to check all of their browser versions (7,8,9,10 and 11, all of which have their quirks...) which I quite frankly can't be fished to do. How dull. At least before I had a quick and dirty 'it will look OK' kind of check.

Updates
I tried to load a site that I'm working on but all I got was "Service Unavailable HTTP Error 503. The service is unavailable." which was not very helpful. The application pool was killed every time I tried to load the site. A quick dig through the event logs and a bit of hair pulling later I found "The Module DLL C:\Windows\system32\inetsrv\rewrite.dll failed to load. The data is the error." coming up. A quick Google and I found that I just had to go to my "Programs and  Features" and repair "IIS URL Rewrite Module 2". Obviously.

I also had a bit of a weird one when running an MVC site which I had mucked around with the default routing, for the home page I was getting the default IIS page. Weird. I don't know where it is coming from or why but adding in a route with an empty URL

routes.MapRoute("Home"""new { controller = "Root"action = "Index"id = "" });

Seemed to do the trick! Again, not sure where this holding page is coming from, why it works fine in the built in server in VS 2012 etc. Currently I'm not overly impressed with M$ for mucking everything around like this, it just makes me sometimes wish I had picked PHP or Java all those years ago! Maybe...