Debugging Windows Phone 7 device traffic with Fiddler


Back in October, I showed how to debug Windows Phone emulator traffic with Fiddler . Since then, I’ve acquired the LG Quantum phone, and naturally, one of my first goals was to start looking at the traffic from mobile Internet Explorer and some of my WP7 applications. The process for capturing traffic from a phone is similar to the process of capturing traffic from another computer . First, enable Fiddler to capture remote traffic, then configure the other client to point at the computer running Fiddler.

You’ll need three things:

  1. A desktop PC running Fiddler
  2. A Windows Phone
  3. A WiFi network that bridges between the phone and the PC

First, I started Fiddler on my desktop PC, named DELL7 — obviously, you’ll need to use your machine’s name for all of the subsequent steps. In Fiddler, click the Tools > Fiddler Options menu, and click the Connections tab.

 

Allow Remote Connections checkbox

Place a checkmark in the Allow remote computers to connect box and close and restart Fiddler. When Fiddler restarts, you’ll see a prompt from the Windows Firewall indicating that it has blocked some features of Fiddler. Tick the three checkboxes and click the Allow Access button.

Windows Firewall blocks Fiddler

Now, Fiddler can capture HTTP and HTTPS requests from other devices.

To verify that this is working correctly, enable your phone’s WiFi connection and open mobile IE. In the browser, type http://DELL7:8888 , and you should see a request in Fiddler and a “Fiddler Echo Service” page in the browser.

Echo Service html

  •  If you can’t see the page, you’ll need to recheck your work so far. In particular, if your Fiddler computer is running on a corporate network with IPSEC enabled (like Microsoft’s corpnet) you will need to get an your IT department to grant you an IPSEC Boundary Computer exception. Otherwise, a device that isn’t IPSEC enabled (like your phone) will not be able to exchange traffic with the Fiddler computer.

Now that your Phone and PC are talking, let’s set the phone’s proxy to point at Fiddler. On the phone, visit the Settings screen and open the WiFi applet.

 

Open the Windows Phone 7 Settings applet  Open the WiFi Settings applet  

The WiFi Settings applet

In the WiFi applet, select the active WiFi connection to open the Edit Network screen. Slide the Proxy slider to on. In the Server/URL box, type dell7 and in the Port box, type 8888 . When you are done debugging your traffic later, come back to this screen and simply move the proxy slider to Off.

Configure the Proxy

Save the settings by clicking the checkmark, and go back to mobile IE. Browse around, and you should see your traffic in Fiddler. If you’ve configured Fiddler to decrypt HTTPS traffic and try to browse to a HTTPS page on your Phone, you’ll see a warning message because Fiddler has resigned the traffic with its own certificate.

 

Windows Phone 7 Certificate Warning

If you click the Continue to website link, you’ll see the decrypted traffic in Fiddler. However, some applications will not offer the opportunity to bypass certificate warnings. If you’d like, you can add Fiddler’s root certificate to your phone’s root certificate store.

Warning : At present, I have no idea how to remove the certificate, so undertake this step at your own risk. In particular, you will likely have problems later decrypting traffic with a different Fiddler desktop PC with your phone, since each Fiddler instance generates its own certificate.

To add the Fiddler root certificate to your phone, visit http://dell7:8888/FiddlerRoot.cer in mobile IE.

Open certificate file

Tap to open the file. Choose Install to install the certificate.

Windows Phone Certificate Install

After you do this, you will find that all HTTPS traffic from mobile IE and applications is visible in Fiddler.

Windows Phone traffic showing in Fiddler

Have fun with Fiddler and Windows Phone 7!

-Eric Lawrence

 

 

 

Comments (24)

  1. Codetoglory says:

    I am having trouble connecting my windows phone 7 to Fiddler. I am running the latest version of Fiddler on Windows 7. I am getting a 'We can't display this page right now' Error: Cannot find server or DNS error. Please advise.

  2. EricLaw [MSFT] says:

    @CodetoGlory: This entire post is advice. Did you try the troubleshooting steps at the "If you can't see this page" section above?

  3. Codetoglory says:

    Hi Eric,

    Fiddler computer is running on my local LAN (Comcast). Do you still think I should check for ipsec boundary exception? if so, where is the best place to check that?

    Thanks

  4. EricLaw [MSFT] says:

    @CodeToGlory: No, it's not IPSEC. I'm guessing that when you originally try to visit http://admin-pc:8888 into the browser (before setting proxy) it still doesn't work? It's possible that your wireless router isn't exposing the LAN's DNS entries to the WiFi connection. You might try with your desktop's IP address instead.

  5. Codetoglory says:

    No luck with using the desktop IP address either. I have opened a question on stackoverflow (stackoverflow.com/…/debugging-windows-phone-7-device-traffic-with-fiddler) to see if any one tried this method. I am not sure if this will help but my device is samsung focus and I use WEP security on my wireless router.

  6. EricLaw [MSFT] says:

    @CodeToGlory: What router do you have? Have you poked around the security/DNS options in the web control panel?

  7. Codetoglory says:

    I am using Linksys Wireless-G Broadband Router (WRT54G) I do not see any obvious settings that come to my mind. DDNS is disabled but I don't think that will help me. Anonymous internet requests are blocked. Everything else is routine stuff.

  8. Codetoglory says:

    Eric,

    I am finally able to see the request in the Fiddler without setting the proxy. But I see 100s and 1000s of requests now and I don't seem to be able to stop. Is this a bug?

    GET http://192.168.1.100:8888/ HTTP/1.1

    Accept: application/vnd.youtube, */*

    Accept-Language: en-US

    UA-CPU: ARM

    Accept-Encoding: gzip, deflate

    User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; SAMSUNG; SGH-i917)

    Host: 192.168.1.100:8888

    Connection: Keep-Alive

  9. EricLaw [MSFT] says:

    If you see the request in Fiddler, then you've confirmed that the phone can talk to Fiddler. You can now set the proxy to point at Fiddler and everything will work.

    (The reason for the "infinite loop" of requests in the case you've described where you're using the IP is that Fiddler is proxying to itself, forever (Fiddler only skips passing along the request when the hostname is localhost, 127.0.0.1, or a hostname specifically configured in Fiddler).

  10. James Andersen says:

    I also had troubles with the proxy setting step…   I could browse to my pc and get the Fiddler Echo service just fine but when I entered the proxy information I couldn't get anything external to work.   In my proxy settings rather than putting the name of my pc I entered (one of) its IP address and then I was able to see traffic through Fiddler.

  11. EricLaw [MSFT] says:

    @James: You left out some details. Are you saying you could browse to the pc using the hostname of the PC, from the Phone's browser? If that's the case, then there's no reason at all that using the same values in the proxy setting wouldn't work.

  12. Bill Gates II says:

    Also can be used to debug on an iOS Device!

  13. juanand@hotmail.com says:

    Kind of weird issue here, but does not work for me but only for WP7 device.

    I have setup latest fiddler in one of my home computers (Win7 x64 in workgroup) and other computers and even entertainment devices can use it as http proxy without issues.

    Laptop is connected via WiFi to the router, and some working devices are over wifi, and others over ethernet, all working fine.

    However, WP7 does not show ANY traffic, neither using http://<IP&gt;, <IP>, http://<computer&gt; or <computer> in the server/URL textbox.

    Hints?

  14. EricLaw says:

    @SuperJaD: Did you specify the port?

  15. juanand@hotmail.com says:

    Sure 🙂

  16. juanand@hotmail.com says:

    Sure 🙂

    I am not connecting WP7 to Zune at all, neither disabling 3G connectivity. That is not needed, right?

    The weirdest thing is that if I leave data connection enabled, it takes very long but ens up retrieving the page over the mobile data connection instead of from Fiddler, having the proxy configured in WiFi profile though.

  17. Resolved! says:

    I finally found the problem. There was an option in my router called AP Isolation that isolates one WiFi client from other. So wired computers could reach WiFi and vice-versa, but not WiFi to WiFi. I just switched that option off, and now it is working as expected. Thanks!

  18. Joe says:

    How do you set your PC so that the phone will connect to the PC?  (3. A WiFi network that bridges between the phone and the PC)

    Thanks,

    Joe

  19. EricLaw says:

    @Joe: I don't really understand your question. The entire article is about how to get your Phone to use your PC as a proxy. If you're asking "How do I configure my WiFi network so that my Phone can get to my PC over WiFi" you may want to look at the "Resolved!" comment immediately before yours.  

  20. Mike says:

    Eric, I can't seem to get this to work on Mango. I've tried two PC's (one with Firewall completely off) and experience the same behavior. I connect my phone to the same Wi-Fi as my computer. I try the http://{hostname}:8888 but only receive page cannot be displayed (again, even with the firewall off). My router is just a cheap Linksys, so I can't imagine it's blocking any connections.

    If I change the proxy on my phone to be {hostname} and port 8888, Fiddler doesn't capture traffic. If, however, I change it to my computer's local IP address instead of using the hostname, I can see my phone browse web pages. Success? Not quite, because I still haven't got the FiddlerRoot.cer on the phone yet. If I try http://{hostname}:8888/FiddlerRoot.cer I get another page cannot be displayed. If I try http://{computerIPaddress}:8888 I see continuous pings in Fiddler but nothing happens in the phone – it's just forever requesting.

    Thoughts?

  21. Frederick D'hont says:

    A friend of mine had most of the problems described here. Just make sure you don't enter http://{yourproxyaddress} in the proxy field, but just the name or IP-address without the http:// in front.

    Something they may want to add for next release is some minor validation on the input for this field ^^

  22. Fito says:

    Been trying to set this up and only get a http://192.168.1.100:8888 entry on fiddler. Android browser never ends loading this and other traffic is not listed at fiddler.

    I followed all steps, fiddler seems to "hear" android but… Don't know what to do next.

  23. oneVoce says:

    hey eric, thanks for fiddler, been a great help.

    I followed the instructions.  I can see the echo page and I see my requests to the echo page show up in fidder.  but no other requests show up in fiddler from wp7.  requests from the local machine also shows up, but no requests from wp7 other than the requests to the echo page.  any idea what's going on?

  24. EricLaw [MSFT] says:

    @oneVoce: If you see the Echo page when navigating to it, that means that you have Fiddler configured correctly and have routability to the desktop. If you don't see other requests, that suggests that either the Proxy settings aren't set properly, or maybe you haven't yet disabled the Cellular connection.