Inspecting request from an IIS server

Let’s say we have a web application which makes calls to other services via http. We want to inspect the calls for bug hunting.

If the calls where made from the browser on the client side then it is simple – use fiddler in order to inspect and analyze the calls.

If you try to do the same with calls made from IIS, you will see nothing by default. Why?

Fiddler is a proxy server for your calls. When you open it it creates a simple listener on 127.0.0.1:8888 and listens for calls. It also registers it self in the registry under HKCU so all calls from processes of the current user are first redirected to fiddler’s address.

You see where I getting at?

IIS runs under a different user and as windows service, so the calls are not redirected to fiddler.

The most simple solution for this problem is to configure your app to use a proxy for it’s calls in the web.config file:

<system.net>  
    <defaultProxy>
        <proxy usesystemdefault="False" proxyaddress="http://127.0.0.1:8888" />
    </defaultProxy>
</system.net>  

This configuration make all the external calls IIS makes to fiddler. Just make sure that fiddler is running when this configuration is set – if not your site will not work…

You can read more about it here.

Yossi Shmueli

Keeping it green since 1995

comments powered by Disqus