This project is read-only.

No way to debug using the local emulator vs. physical device

Aug 4, 2011 at 5:09 PM
Edited Aug 4, 2011 at 5:15 PM

Took me a lot of time and energy to realize (and finding supporting documentation).

The samples works flawlessly (when properly setup) using the local Azure emulator and the WP emulator on the same machine (obviously). It works using either local or real, cloud storage.   Also, if you deploy the app to the Cloud and properly setup the certificates, etc. the client application will run (be able to connect) without issues from both the local WP7 emulator and from a physical device.  You cannot debug the server (web role) in this scenario though as it is in the Cloud.

Now, if you try to debug on a physical device connected (so I can attach the debugger to it) to the PC running VS and the Emulator (attached as well, so I can debug) there is no way for this setup to work :S.

See, the Azure emulator responds to requests coming from and nothing else. Furthermore, looking at it to the Listening Ports section on the Resorce Monitor, one can see that the emulator binds only to the Loopback adapter. So, if you try to access your emulator's HTTP endpoints using the PC's real IP address it will simply not connect (just try telnetting to the listening port).   Therefore, the only choice to be able to connect is localhost.    On the emulator, localhost resolves to the local-host where the emulator runs so its all good. But on the device it references self (the device) and not the PC.

I won't list all things I tried to do to try to overcome this (includes messing with my public DNS pointing to the internal network, messing with the Emulators and the Deployment's config files, etc.)  Nothing works.  I haven't tried but the same scenario will take place using any other client, including mobile devices with other operating systems.

Debugging on a real device against the emulator on the local machine is the ideal scenario, particularly when performance or memory constraints are present. Cannot be attained due to the restriction on the Azure Emulator. Plain sucks.   I suspect more than one who has had issues with connectivity about not found enpoints ("Have you installed the SSL certificate?" message) has been involved in this scenario. Besides, this limitation is on the Azure emulator so it will certainly affect other scenarios not involving WP7 where one wants to run it in the local network (for debugging purposes or whatever else), including but not limited to other mobile OSs (is there an emulator for iPhone on Windows?).

If someone has a workaround for this, please share it. On the meantime I guess I'll have to share my 3GB of RAM between VS, the Azure emulator, SQL Express and the phone Emulator on top of the OS...

  • Open question: If I run my web role on local IIS, will the results differ to if I ran it inside the debugger? What about storage? SQL Azure?
Aug 5, 2011 at 9:49 PM


I too came to similar conclusions, I have spent a massive amount of time/energy trying to figure out what was wrong, and simply decided the emulator doesn't work with a device.

I can't even run the app on my device properly (not debugging) while using the emulator. Is there a good guide on how to deploy the app on the cloud, instead of the emulator? I'm basically using the WP7 Toolkit webrole, no changes there. I'm accessing Table and Blob storage.