Fiddler and the Windows Phone 7 Emulator


Note: This post is part of a larger set on using Fiddler with Windows Phone 7. This post covers the Windows Phone Emulator only.

Recently, some developers have asked me why Fiddler no longer works with the Windows Phone 7 emulator. Fiddler properly captured traffic from the CTP version of the emulator, but not from the final RTM version. I’ve asked the Phone team for more details, but today I’ll share a workaround with you that allows you to see traffic from the RTM version of the emulator.

  1. Install Fiddler 2.3.0.7.
  2. Start Fiddler.
  3. Click Tools > Fiddler Options.
  4. Open the Connections tab and tick the Allow remote computers to connect box
  5. Click OK to close the Fiddler Options dialog.
  6. In the QuickExec box under the session list, type prefs set fiddler.network.proxy.registrationhostname HostName where HostName is the name of your desktop computer.
  7. Close and restart Fiddler.
  8. Start (or restart) the Windows Phone 7 Emulator.
  9. Open Internet Explorer on the Emulator.
  10. Observe, your traffic shows in Fiddler.

If the browser on the phone works properly, but you don’t see the traffic in Fiddler, that suggests that you may have a Filter applied which is hiding the traffic. See this help topic for more information.

If you have enabled HTTPS Decryption in Fiddler, note that the Phone’s browser will show a certificate warning page when navigating to HTTPS pages. The Phone Emulator uses a different root certificate store than the desktop, so even if your desktop trusts the Fiddler Root, the Phone Emulator will not.

Thanks for using Fiddler, and thanks for developing for Windows Phone 7!

-Eric

PS: Please remember that you’ve reconfigured Fiddler as in Step #6. If you ever rename your computer to something else, you’ll find that Fiddler “mysteriously” stops working, because it will be telling everyone to use a proxy on a non-existent machine name. 🙂 To fix this, simply type about:config in the QuickExec box, and delete the entire row containing fiddler.network.proxy.registrationhostname.

Update: These steps also work in Windows Phone 8’s emulator as of 10/31/2012

Comments (30)

  1. Kamran says:

    This works great, thanks!

    Now I notice that the emulator doesn't work on network anymore unless Fiddler is running.  How do I got about reversing this?

  2. EricLaw [MSFT] says:

    @Kamran: My guess is that the emulator picks up the system proxy settings when it starts up. So, you may need to restart the emulator after starting/stopping Fiddler.

  3. Phooby says:

    After following the instructions, with Fiddler running, I get the following in IE in the emulator.

    "Error: Cannot find server or DNS error".

    I'm going straight out to the internet, so there's no proxy involved.  

    It's happening on more then one machine.

    I can surf via Internet Explorer on the desktop.

    Any idea?

  4. EricLaw [MSFT] says:

    @Phooby: What *exactly* did you type? Do you see any requests from the emulator in Fiddler itself?

  5. Phooby says:

    Hi @EricLaw

    prefs set fiddler.network.proxy.registrationhostname <pcnamehere>

    I see no requests.

  6. EricLaw [MSFT] says:

    @Phooby: You must replace <pcnamehere> with the hostname of your PC (e.g. "ericlaw7" is my machine). You must also change the other specified settings and restart Fiddler in order for this to work.

  7. Trees says:

    Hi Eric,

    Thanks for this and your work with Fiddler in general. Seriously helpful. Enjoyed your chat on DNR last year as well 🙂

    Regarding https from wp7… working as said from IE… I wondered if there's a way to debug from apps.. like via httpwebrequests to secure services? For now, getting resource not found if decrypt is enabled.

  8. EricLaw [MSFT] says:

    Debugging web services from the phone *should* work as well. (For insecure requests, I know I see service requests from the Bing App, for instance). Did you install the Fiddler Root certificate on the device? If not, then I'd expect the service calls to fail with a security error.

  9. Trees says:

    That sounds like the key to it.. any idea how you would do that? Like where to put it?

  10. EricLaw [MSFT] says:

    Mick: Navigate directly to the URL http://fiddlermachinename:8888/FiddlerRoot.cer to get a prompt to install the root certificate on the device. Note that you need to be running the latest version of Fiddler for that URL to work.

  11. Trees says:

    Ok, great ty – funnily enough.. I was having a look around yesterday for the release notes for the latest ver and got distracted before finding them.

  12. Phani says:

    I got Fiddler version 2.3.3.0. I m not able to find 6th step option given above. can you please guide me where i need to do these changes to make it work in fiddler. Thanks!

  13. mark says:

    awesome…fixed my problem. it works on latest version of fiddler as well and saved the day while i was trying to debug a problem. thanks.

  14. JP says:

    Great stuff, thank you!  One note you might add: by default my Fiddler was capturing Web Broswers instead of All Processes. Once I switched over to capturing All Processes, everything worked fine.

  15. HenryGab [MSFT] says:

    Does this open Fiddler as a proxy to all remote machines, or only the WP7?  If all machines, does this mean Fiddler is now proxying requests under my user account?  If so, I'd be interested in the security effects….

  16. @HenryGab: When you configure Fiddler to allow remote connections, it will proxy remote traffic. By default, if your firewall settings allow, that would include traffic from other computers on your network that have configured themselves to use your computer as a proxy. There's no benefit to an attacker to be proxying requests "under your user account" unless you've written script to set the x-AutoAuth session flag. However, an attacker *could* use this proxy as a "bounce" to circumvent IPSEC, if IPSEC is configured in your environment.

    If you want, you can write script to only allow traffic from certain sources; see stackoverflow.com/…/how-to-program-fiddler-to-restrict-ip-range-for-reverse-proxy-mode

  17. subodh1984@hotmail.com says:

    I am trying to intercept all the requests/calls from an app in Windows phone 7 emulator. However, all i can see is CONNECT request similar to abc.xyz.com:443. I cannot see any other requests/calls (for example login call) made by the app. How can I intercept the requests made by an app in windows 7 emulator?

    Thank You,

    Subodh

  18. subodh1984@hotmail.com says:

    @EricLaw: Thanks for your prompt response! Well, I can intercept https traffic from IE within Windows 7 emulator. However, I am still not able to intercept the HTTPS requests made by an app within windows 7 emulator.

    For example, if I try any https site in *browser* in windows 7 emulator, i do get IE specific certificate error >> however, after clicking on "continue to website (not recommended)" link i can access the site and intercept the HTTPS request in Fiddler.

    When I click a link in the *app*, it also generates same certificate error. However, this time when I click on "continue to website (not recommended)" link, it displays another error "We're having trouble displaying this page"… Not sure what is going here .. all I want to do is trap all requests coming from the app …

    any help is deeply appreciated..

    Thank you in advance!

    Subodh

  19. EricLaw [MSFT] says:

    You should consider following the instructions to trust the certificate.

  20. subodh1984@hotmail.com says:

    I accepted the root certificate in Windows phone emulator. However, it stll receive an error —

    Here is the error log:

    16:44:36:7327 Fiddler Running…

    16:46:25:4476 Fiddler.BCCertMaker> Creating Root certificate

    16:46:35:9600 [Fiddler] Failed to read HTTPS request from (xde:6768) new client socket, port 60939.

    16:47:12:8625 [Fiddler] Failed to read HTTPS request from (xde:6768) new client socket, port 60945.

    16:48:30:8578 [Fiddler] Failed to read HTTPS request from (xde:724) new client socket, port

  21. EricLaw [MSFT] says:

    What specifically happens in XDE in this case? Do you still get a cert error?

    It sounds like you've installed the pluggable certificate maker on the machine in question. Have you tried without that installed? You may want to use CertMgr.msc to delete all Fiddler related certs in your Personal and Trusted stores and retry.

  22. subodh1984@hotmail.com says:

    [EL] What specifically happens in XDE in this case? Do you still get a cert error?

       –  Yes, I still get a cert error

    [EL] It sounds like you've installed the pluggable certificate maker on the machine in question

       –  Yes, I downloaded Certificate Maker meant for Apple IOS. When I accessed the link in the app, it asked to accept the cert which i did in windows phone emulator. It still displayed a cert error

    [EL] Have you tried without that installed?

       –  Yes, but no luck. Please refer to my second comment here on Tue, Aug 16 2011 2:09 PM

    [EL] You may want to use CertMgr.msc to delete all Fiddler related certs in your Personal and Trusted stores and retry.

       –  I have deleted all the Fiddler related certs. 1. Re-installed Fiddler 2. Followed steps in this blog 3. Similar to my 2nd comment. I can access the site thru IE in emulator. However, I cannot access the same site when launched through app. I am assuming that there is some prob with my app

    Thank you for all your help!

    Thank You,

    Subodh

    P.S. – Without any proxy the app works fine

  23. EricLaw [MSFT] says:

    If you see a certificate error in IE, then there's a problem in the certificate trust configuration. That problem will kill the app's ability to use HTTPS.

  24. Raghav Sethi [MSFT] says:

    I'm using FiddlerCore to intercept traffic from a Windows Phone 7 emulator. But if I apply the same settings to FiddlerCore like this:

    Fiddler.FiddlerApplication.Startup(8877, true, true, true);

    and FiddlerApplication.Prefs.SetStringPref("fiddler.network.registrationhostname", <mypcname>)

    And run my program, the browser on the emulator stops working and my app is unable to intercept traffic. The steps you describe above work perfectly for Fiddler with UI, though.

  25. Vinod K says:

    In case of Windows, the certificate of fiddler should be put into the emulator, an easy way to do this would be to use a http file server like hfs and access the same file within the emulator  or we can also install the same  fiddler certificate from the web.

    Now the app traffic would be captured in the fiddler as the emulator now has the fiddler root certificate.

    EricLaw: Fiddler serves the certificate from http://ipv4.fiddler:8888/fiddlerroot.cer. Please post questions to the Fiddler Discussion forum (see the Help menu) as I am no longer at Microsoft.

  26. cwiederspan@live.com says:

    Eric, Awesome – you've made troubleshooting my WP8 app much easier with this article. I'm still having a little bit of trouble on the "last mile". I've done everything above, and I can use Fiddler to see traffic from my WP8 emulator as it's going to the outside world (e.g. if I'm hitting google.com from IE on the phone).

    However, my end goal is to see traffic originating from WP8 emulator and hitting a WebAPI project that's debugging/running on my computer (the same computer running the emulator). The app is actually working, and hitting the dev project, because I can debug it in VS2012 as it hits the breakpoints. It's just not showing in Fiddler.

    I'm 95% sure I don't have any type of filtering going on that would filter that traffic out. And I'm using an address like http://my-laptop/api/stuff when accessing the dev machine from the WP8 app (took me a while to figure out that localhost on the phone wasn't going to work :-)).

    Additionally, if I change my WP8 app to use my Azure website – my.azurewebsites.net/…/stuff instead of http://my-laptop/api/stuff – then I can see that traffic too, which is another piece of the pie.

    So, I've got all of the pieces, they're just in different places. I'd love to be able to see the traffic in Fiddler AND debug it in VS2012 at the same time, but right now I can either do one or the other (either Fidder to azure, or debug local dev), but not both at the same time.

    Any idea if this should be working, and where I might have something setup wrong?

    Thanks in Advance – you're a lifesaver!

    EricLaw: Please post questions to the Fiddler Discussion forum (see the Help menu) as I am no longer at Microsoft.

  27. Dipak Boyed says:

    Do we need to specify fully qualified machine name (with domain info) or a short machine name only?

  28. EricLaw [ex-MSFT] says:

    @Dipak: Typically, either will work.