Archive

Archive for December, 2012

Debugging on a mobile device using Fiddler and IIS Express

December 28, 2012 Leave a comment

When writing mobile web applications that work against  a RESTful API its useful to be able to trace all HTTP traffic generated by the app. In this post, I’m going to describe how to set up an ASP.NET Web API project hosted within IIS Express so that you can view the traffic generated by a mobile device (i.e. your iPhone). The technique I’m outlining here does _not_ rely on configuring a proxy on the mobile device, which is cumbersome in case you don’t have a device reserved exclusively for development. Replace the ports and hostnames in the instructions below to fit your environment. This setup requires that you can resolve your dev machines’ hostname using DNS in your local network.

Expose IIS_Express on the FQDN of your host

Open C:\Users\YourUser\Documents\IISExpress\config\applicationHost.config and edit the binding for your web api project.
Replace <binding protocol="http" bindingInformation="*:1182:localhost" /> with <binding protocol="http" bindingInformation="*:1182:hostname.domain.com" />

Add a URL Reservation:

We need to allow external connections on the port used by IIS Express. Run the following command from an elevated prompt: netsh http add urlacl url=http://hostname.domain.com:1182/ user=everyone

Configure Fiddler to proxy incoming traffic

See http://www.fiddler2.com/Fiddler/Help/ReverseProxy.asp and use option#2.

Connect with your mobile device

Use http://hostname.domain.com:1182/ to access IIS Express directly and http://hostname.domain.com:8888/ to route all HTTP requests through fiddler.

Advertisements
Categories: Uncategorized
%d bloggers like this: