tags:

views:

168

answers:

3

We're in the process of replacing an old (5+ years) Windows service application built with VS2005 that makes an HTTP GET call. There are several things that make this difficult (such as the web server is on the customer's network and we can't connect directly to it) and, unfortunately, we'd prefer not to take down the running system to replace it with a WinForm version that can be monitored by Fiddler. The new code appears to be doing everything correctly, but, alas, it is failing to authenticate.

Is there a way to configure Fiddler (2.2.9.1) to intercept HTTP calls from a Windows service?

+3  A: 

Fiddler just acts as an HTTP proxy, so if you can configure a proxy in your service then you can configure it to go through Fiddler. Whether that's possible is hard to say...

If that doesn't work, you could do it by running Fiddler on a second computer and configuring it to listen on port 80. Then on your "test" computer, edit your hosts file so that it points to the second computer instead. So say the web service is on www.example.com, you set up your test server so that "www.example.com" points to your second computer (running Fiddler). Then, when the service goes to connect to "www.example.com" it'll actually connect to Fiddler. Fiddler will then forward the connection to the real www.example.com after recording the request/response.

I haven't tested the above, but I think it would work. Obviously, if you can configure the proxy settings in your service that would be easier!

Dean Harding
A: 

And, of course, if Fiddler doesn't work there's always Wireshark. As a hint, use a couple filters in Wireshark (e.g. show only packets going to or coming from the destination IP) to avoid feeling like you're being overrun with data.

erjiang
+2  A: 

Codeka provided a clue to get me going in the right direction. The piece that was still missing was how to get the proxy configured. The <appname>.exe.config needed to have a section like the following added:

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

Once this was done the Windows service's http traffic started flowing through Fiddler.

Mike Chess
http://www.fiddler2.com/fiddler/help/hookup.asp#Q-DOTNET
EricLaw -MSFT-
@Eric - Thanks for posting the link. I'd actually seen that FAQ item while following Codeka's clue. It just wasn't immediately obvious that it applied to Windows services.
Mike Chess
FWIW, it has nothing to do with "Windows Services" and everything to do with the fact that your service is written in .NET. :-)
EricLaw -MSFT-