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="*" />

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= user=everyone

Configure Fiddler to proxy incoming traffic

See and use option#2.

Connect with your mobile device

Use to access IIS Express directly and to route all HTTP requests through fiddler.

Categories: Uncategorized
%d bloggers like this: