The Windows Phone 8 SDK has been released, and running the emulator for Windows Phone 8, requires that your PC has Second Level Address Translation (SLAT). This in turn needs Hyper-V. Now, I possibly don't have a typical setup on my laptop. I run VMware workstation, Hamachi for our private VPN, Cisco VPN client when I am on site for one of our customer, and the excellent ESET AV software. Each of these can use their own network protocol.
We were lucky enough to have early access to the SDK and as such could get down to testing early. When I installed the SDK, I was informed that it was unable to add the current user to the Hyper-V users. After some searching and head scratching, I came across John Howards' Blog specifically Explaining the Hyper-V authorization model. I downloaded the script file, and ran the command:-
cscript hvremote.wsf /add:machinename\"username"
This adds the username as a Hyper-V administrator, using the downloaded script file hvremote.wsf.
So it was with great excitement (sign of a sad life) that I fired up VS2012, created a Windows Phone 8 application, and fired it up to run on the emulator. The gears ground away, and I was greeted with:-
I clicked on 'Retry', and the emulator fired up - great I thought! Spoke to soon, as the emulator then gave me the message:-
I did some 'messing around' with various network connections, but didn't make much headway, and occasionally received a message of:-
I reached out to my colleagues, who by now are used to me asking obscure questions about 'why doesn't this work?'. I received the (smug) developer responses that 'it works OK on my system' that I have joyously answered people in the past. Unfortunately, this didn't help me! Andy did mention that he had heard of this problem, and the person concerned had fixed it, but he didn't know how, and didn't remember who. He did however, put me in touch with Greg Mennenga from Microsoft who showed great patience helping me solve this.
Greg was sure the problem was to do with the many network protocols, and the many pseudo adapters on my system, for VMware, Hypervisor, Hamachi etc. On the network adapter we trimmed this down to just the ones needed, and managed to get it working - great. I worked away on changing and adding facilities to one of our apps, and all was sweetness and light, although I was unsure which of our many attempts had fixed this.
As mentioned earlier, we had early access to the SDK, so when a new version was available I downloaded it and installed it. I went back to working on our app again. I did some more coding, ran the application to test, and was back to "You don't have permission to modify internal Hyper-V network adapter settings required to run the emulator". Cue cursing swearing muttering and slamming about, followed by a system restore, as I was busy.
When the final release came out, I decided I had to bite the bullet, and install the final release. As expected, the emulator didn't work for the same reasons as before. The solution turns out to be fairly simple.
First, run the Hyper-V Manager, and click on the Virtual Switch Manager. If there is no entry resembling 'Windows Phone Emulator Internal Switch', click on 'New Virtual Switch', choose 'Internal' and then 'Create Virtual Switch'.
Create a new entry called Windows Phone Emulator Internal Switch, add any notes you want, and then click on OK - this will create the emulator switch.
Next, open the Network and Sharing Centre by right clicking on your network icon in the system tray or accessing it via the control panel. Then click on Change adapter settings. You will see a list of your network adapters, including the one we have just created.
Right-click on the adapter, and select properties.
Un-tick all the items except for:-
• Client for Microsoft Networks
• QoS Packet Scheduler
• File and Printer Sharing for Microsoft Networks
• Microsoft LLDP Protocol Driver
• Link-Layer Topology Discovery Mapper I/O Driver
• Link-Layer Topology Discovery Responder
• Internet Protocol Version 6 (TCP/IPv6)
• Internet Protocol Version 4 (TCP/IPv4)
and click on OK.
At this point I saved everything I had done, and re-booted my system. When it fired up again, I ran VS2012, and created a test project, ran it and saw...
You MAY need to disable your VMware adapters - you may not. If you still have problems, you can check what network adapter your emulator is using, by running Hyper-V Manager. You can see the list of virtual machines running. Click on one of the emulators, and then at the bottom, click on the 'networking' tab, and you can see which network adapter your emulator is using.
My grateful thanks go out to Greg for helping solve this problem, and I hope this helps you if you have problems configuring and connecting to your emulator using Hyper-V.
Originally posted 1/Nov/2012