Showing posts with label Emulator. Show all posts
Showing posts with label Emulator. Show all posts

Wednesday, June 18, 2014

Error Code 1026 XDE.exe - Can not start Windows phone 8 emulator

I installed VS 2012 and the WP 8 SDK.  I built a simple application and attempted to start up the emulator.

I got the following error:

Application: XDE.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.

Cause:
It was unable to enumerate the vSwitches. when I opened Hyper-V manager and clicked on 'Virtual switch manager'. It gave me an error saying 'An error occurred while trying to retrieve a list of virtual switches'

Solution:

This error, I was able to resolve by adding 'Hyper - V Extensible Virtual Switch' protocol in 'Ethernet Properties'
by Uninstalling and Reinstalling Hyper-V from 'Turn windows features on or off' in control panel.

Tuesday, June 10, 2014

Connecting Windows Phone 8 Emulator to localhost.

A while back I blogged on connecting to localhost from windows phone emulator.  I was trying out a new dev build today and having issues.  Debugging was failing to connect on my VS 2013 build. I realized that I was having firewall issues.
I started by turning off all the firewalls to determine if this was the issue. Once the firewall was down I was able to connect from the emulator to localhost. I then modified the netsh command.

Change the profile to public on the firewall connection.

> netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=58938 profile=public remoteip=localsubnet action=allow

Friday, April 18, 2014

Virtualize Windows Phone 8/8.1 development

Problem:
Microsoft has released Windows Phone 8.1 for developers.  Naturally I am just finishing my first real WP8 app using the 8.0 SDK.  Until now I have hosted the bits on my native system with no virtualization.  I thought I should have a vm for each version of the phone os. I was getting ready to dive into Hyper-V but realized an issue.  You see the windows phone emulator runs as a separate vm on top of the native OS.  If I did manage to build my dev environment in one vm I would either need to run the emulator within the vm.  That is a vm inside another vm which Hyper V will not support or connect a phone emulator vm to the dev vm in hyperv.  This sounds terribly complex for my peabrain.

Solution:
I decided to go old school and use an old Scott Hanselman post about boot to VHD.  In fact, the Nokia site actually links to Scott's site directly.  Here is the solution long and short:

1.) Create a vhd on your native os.  Mine is Win 8.1 Enterprise x64.
2.) Change your BIOS'es boot order. We want boot to usb.
3.) Create the USB thumbdrive with requiste OS bits (Scott describes this in his article)
4.) Boot to usb and initialize the vhd with the target OS Windows 8.1
5.) Complete setup
6.) Install VS 2013 RC2 which will include the 8.1 SDK
https://dev.windowsphone.com/en-us/downloadsdk

Done!
Source:
 
How to virtualize the Windows Phone environment

Windows Phone 8 Emulator in a Windows 8 VHD
Create VHD from Scott Hanselman

Friday, April 4, 2014

Windows Phone 8 Emulator connecting to localhost...

Problem:

Well this getting the Windows Phone emulator to work with a web service running on localhost turned out to be more work then I thought.  There are a multitude of blogs and postings to walk you through the process. Each implementation is slightly different and my issues may be unique to my box.  That said I did want to document what caused me so many issues. 

Solution:

1 – Bind your application to your public IP address

Normally when you run an application in IIS Express, it’s only accessible on http://localhost:<port>.
In order to access it from another machine, it needs to be bound to your public IP address as well.
Open D:\Users\<YourName>\Documents\IISExpress\config\applicationhost.config and find your site.

<site name="Test.Web" id="2">   
<application path="/">       
<virtualDirectory path="/" physicalPath="C:\Users\Jeff\Test\Test.Web" />   
</application>   
<bindings>       
<binding protocol="http" bindingInformation="*:39142:localhost" />   
</bindings>
</site>

In <bindings>, add another row:
<binding protocol="http" bindingInformation="*:39142:169.254.80.80" /> (But with your IP, and port number, of course)

2 - Allow incoming connections

If you’re running Windows 7/8, pretty much all incoming connections are locked down, so you need to specifically allow incoming connections to your application. First, start an administrative command prompt. Second, run these commands, replacing 169.254.80.80:39142 with whatever IP and port you are using:

> netsh http add urlacl url=http://169.254.80.80:39142/ user=everyone
This just tells http.sys that it’s ok to talk to this url.

> netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=39142 profile=private remoteip=localsubnet action=allow
This adds a rule in the Windows Firewall, allowing incoming connections to port 39142 for computers on your local subnet.


Key learnings:

1.) Command prompt
2.) ipconfig
Results may vary:

Ethernet adapter vEthernet (Internal Ethernet Port Windows Phone Emulator Internal Switch):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::c0fc:ebf2:755d:4a03%14
   IPv4 Address. . . . . . . . . . . : 169.254.80.80
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Default Gateway . . . . . . . . . :

3.) Emulator IP is 169.254.80.80

4.)Cut and paste line to add a second binding row.
binding ip needs to be exactly what the IP for the emulator is:

bingingInformation="*:<port>:<ip address>"

Sample:
bindingInformation="*:39142:169.254.80.80"

5.)Allow incoming connections
Open cmd as admin
>netsh http add urlacl url=http://169.254.80.80:39142/ user=everyone

6.)Adds rule in the Windows Firewall, allowing incoming connections to port 39142 for computers on your local subnet.
 Open cmd as admin
>netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=39142 profile=private remoteip=localsubnet action=allow

Addendum:
 Debugging was failing to connect on my VS 2013 build.  I realized that I was having firewall issues.
I started by turning off all the firewalls to determine if this was the issue.  Once the firewall was down I was able to connect from the emulator to localhost.  I then modified the netsh command.

Change the profile to public on the firewall connection.

> netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=58938 profile=public remoteip=localsubnet action=allow



Research How tos:

MVC Sample

http://blog.anthonybaker.me/2013/06/how-to-connect-to-local-web-services.html

Microsoft has drafted a how to guide using a wcf web service
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj684580.aspx

Robert McMurray has a great guide on connecting the emulator to a Web API project in Visual Studio.
http://blogs.iis.net/robert_mcmurray/archive/2013/08/20/connecting-the-windows-phone-8-emulator-to-web-api-applications-on-a-local-computer.aspx

Johan's succint post gave the key steps in the process
http://johan.driessen.se/posts/Accessing-an-IIS-Express-site-from-a-remote-computer

Tip using fiddler
You can install fiddler and go through the instruction on how to configure fiddler for windows emulator.
This article worked just fine for me:http://blogs.msdn.com/b/wsdevsol/archive/2013/06/05/configure-the-windows-phone-8-emulator-to-work-with-fiddler.aspx
One the configuration is done, emulator will automatically use fiddler as a proxy server and you localhost should work just fine from emulator too.
Remember to start fiddler before starting the emulator to route the traffic, otherwise it wont work. You will also be able to monitor http/https requests made by windows emulator.

Source:
http://stackoverflow.com/questions/13149304/windows-phone-8-emulator-access-localhost