1

I have gone through the forum and tried those techniques but still Fiddler is not able capture my traffic. Any help would help.

Following works with Fiddler, so my WebAPI server is working. My C# client returns OK.

http://localhost:49305/api/Employee/12345

.

Host file

 #localhost name resolution is handled within DNS itself.
 #127.0.0.1       localhost
 #::1             localhost

.

    static async Task GoAny()
    {
        HttpClientHandler clntHand = new HttpClientHandler()
        {
            CookieContainer = new CookieContainer(),
            Proxy = new WebProxy("http://localhost:8888", false),
            UseProxy = true,
            UseDefaultCredentials = false
        };

        HttpClient clnt = new HttpClient(clntHand)
        {
            BaseAddress = new Uri("http://localhost:49305")
        };

        clnt.DefaultRequestHeaders.Accept.Clear();
        clnt.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));


        HttpResponseMessage resp = await clnt.GetAsync("api/Employee/12345");
        if (resp.StatusCode == System.Net.HttpStatusCode.OK)
        {

            string c = resp.Content.ToString();
        }
    }
user1174790
  • 309
  • 4
  • 11
  • Are you 100% sure you don't have show "browser only" filter in Fiddler (look at bottom left corner of Fiddler window)... – Alexei Levenkov May 31 '15 at 20:00
  • I could not find setting saying 'browser only' by my filter tab is fully grayed out and nothing is checked there. "Tool->Connections" says "Bypass Fiddler for URLs that start with" = "<-loopback>;" – user1174790 May 31 '15 at 20:19
  • 3
    Thanks Alexi.. Appending ".fiddler" to localhost solved it. That is "http://localhost.fiddler:49305". Now Fiddler shows traffic flow. – user1174790 May 31 '15 at 20:22
  • 2
    You should post that as answer (and eventually accept it). – Alexei Levenkov May 31 '15 at 20:59
  • 1
    Further (official) detail: http://docs.telerik.com/fiddler/Observe-Traffic/Troubleshooting/NoTrafficToLocalhost – Brendan Green May 31 '15 at 21:45
  • Saved my ass on something thank you! – Shawn Aug 19 '15 at 18:23
  • So this was solved by an answer for [virtually the same question](http://stackoverflow.com/a/31136258/1801588). Should we make it a proper answer here or close as a dupe? – Pavel V. May 31 '16 at 10:03
  • 1
    Possible duplicate of [How can I trace the HttpClient request using fiddler or any other tool?](http://stackoverflow.com/questions/22500299/how-can-i-trace-the-httpclient-request-using-fiddler-or-any-other-tool) – Michael Freidgeim Jan 18 '17 at 11:26

1 Answers1

4

This is a known issue when using localhost.

Your url is http://localhost:49305 and you need to change it to include .fiddler after localhost: http://localhost.fiddler:49305.

Once you have done this, the request from HttpClient should then appear in Fiddler.

Please see this SO question: How can I trace the HttpClient request using fiddler or any other tool?

Community
  • 1
  • 1
Karl Gjertsen
  • 4,690
  • 8
  • 41
  • 64