The emulation tools in Internet Explorer’s F12 Developer tools are a godsend when you have to support older, legacy versions of IE in your solution, but sometimes you’ll run into issues where even the emulation mode isn’t close enough to the real thing. That’s exactly what happened to me recently. I was developing a new feature in an ASP.NET MVC application using Angular.js on the client and the page wasn’t updating after calling the server to refresh, but only in IE 9. Weird, it worked just fine on my machine in IE 11 emulating IE 9, but I had just watched the QA engineer do the exact same thing in IE 9 and it had definitely not worked.
Luckily Microsoft has been kind enough to provide virtual machine images that can be downloaded for just this purpose on the modern.ie web site (http://dev.modern.ie/tools/vms/). To use these virtual machines you will need to have Hyper-V, VirtualBox, Virtual-PC, or VMWare installed. In my case I chose to use VirtualBox, but I also have seen VMWare work with the same steps.
Steps To Configure Your Machine
In order to get your machine configured so you can run IE9 (or another version) in a virtual machine running against your local machine follow these steps.
- Download and install the latest version of VirtualBox from Oracle @ https://www.virtualbox.org/wiki/Downloads
- Download the appropriate Virtual Machine Image from modern.ie @ http://dev.modern.ie/tools/vms/
- Virtual Machine: [Choose the version of IE and Platform you wish to test]
- Platform: Select VirtualBox
- Click Download .zip
- Extract the contents of the zip and save it someplace safe.
- The zip should contain a file named “IE9 – Win7.ova” or something similar.
- Launch VirtualBox
- Select File Import Appliance
- Browse to the file you saved in step 3 (IE9 – Win7.ova) and click next
- Optional: I adjusted the memory from 512MB to 2GB (I would recommend this if you have the memory to spare on your host PC.)
- Click Import and wait…
- The import process took about 40 minutes on my machine…
- From an Elevated Command Prompt (Run as Administrator) Execute: netsh http add urlacl url=http://myhostname:2000/ user=everyone
- Substitute whatever your machine name is for the host name (myhostname)
- Substitute the port number you are using when running your application in IIS Express.
- Edit your IIS Express Application Configuration file (at My Documents > IIS Express > config > applicationhost.config)
- Find the binding for the application you would like to debug
- <binding protocol=”http” bindingInformation=”*:2000:localhost” />
- Copy this line and paste it as a new line directly underneath the existing line in the XML
- Change “localhost” to the name of your computer.
- <binding protocol=”http” bindingInformation=”*:2000:MyComputerName” />
- Start the application running in Visual Studio.
- Some of the documentation I found online suggests that you may need to run Visual Studio with elevated permissions (Run as Administrator), but that has not been my experience. I suspect I may already have whatever permission is needed on my account, your mileage may vary.
- Launch your virtual machine
- Browse to http://MyComputerName:2000/
Note: I expected to have to make a Windows Firewall rule to allow the traffic but I did not have to in order to get it working on my machine. If you have issues, that is the first place I would look. I would probably just turn off windows firewall all together and test. If that works, turn it back on and create a rule.
Note: I ran into an issue today where I needed to log in and I didn’t know/remember the password for the IEUser account on the virtual machine. You can find that information in the Virtual Machine Instructions document.