How to display localhost traffic in Fiddler while debugging an ASP.NET application?
Asked Answered
S

14

80

How do I display localhost traffic in Fiddler while debugging an ASP.NET application?

Silken answered 5/5, 2009 at 17:54 Comment(1)
As of IE9, no special tricks are required. blogs.msdn.com/b/fiddler/archive/2011/02/10/…Torture
F
88

try using this:

http://ipv4.fiddler/folder

instead of

http://localhost/folder

this also works with ports

http://ipv4.fiddler:12345/folder

Here is link to fiddler documentation

http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/MonitorLocalTraffic

Foreordination answered 5/5, 2009 at 17:59 Comment(1)
Note: This is required only for IE, and only IE8 and earlier. <=IE8 was so smart, it KNEW you wouldn't want to use a proxy server for local traffic! So it sees 'localhost' in your url and doesn't bother with your silly proxy server settings, which is how Fiddler hooks in.Abreaction
I
52

To make Fiddler work on localhost with IIS Express you should use this form of URL

http://localhost.fiddler:50262/

This puts correct Host header value (localhost) which satisfies IIS Express.

Ingold answered 13/11, 2012 at 9:30 Comment(3)
This worked a treat for me trying to use Excel OData feed import from my test site running under Visual Studio/IIS Express.Pneumothorax
Was banging my head against the wall, this worked great for me also!! Thanks!Pretence
This works for locally hosted IIS express Asp.net web api. cheers.Daciadacie
D
20

Start Fiddler. Go to Tools--> Fiddler Options. Choose Connections tab. Check the 'USe PAC Script' option.

Now you will be able to monitor local traffic as well

Daughterly answered 27/8, 2010 at 19:52 Comment(1)
I had problems adding the . with SSl and our companies proxy, but changing this setting did the trick. Thanks!Cockeye
S
12

For an ASP.NET web site project:

1) Right-click the project and select Property Pages
2) Select Start Options
3) Under the Server section, click the "Use custom server" and edit the Base URL by replacing localhost with your computer's name.

Silken answered 5/5, 2009 at 18:20 Comment(0)
N
7

Probably the easiest way to monitor traffic to localhost is to replace "localhost" with "localhost." in the browser's URL bar. E.g.

http://localhost./MyApp/default.aspx
Nasal answered 23/7, 2009 at 8:44 Comment(0)
L
4

Using Fiddler v4:

  1. Check your IE proxy settings

IE->Tools->Internet Options->Connections->Lan Settings

IE Lan Settings

  1. Check your settings in Fiddler:

Fiddler -> Options-> Connections & Https

Check the Fiddler port, default is 8888 Fiddler port

  1. In Fiddler-Menu:

File -> Capture Traffic is checked

The following solution worked for me, when using a

  • HttpClient or
  • WebClient from inside an ASP.NET application.

Web.config

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

Code:

var resourceServerUri = new Uri("http://localhost.fiddler:YourAppServicePort");
var body = c.GetStringAsync(new Uri(resourceServerUri)).Result;



Check if your request actually reaches fiddler by customizing the Fiddler Rules script

Fiddler->Rules->Customize Rules

and hook into the OnBeforeRequest event:

static function OnBeforeRequest(oSession: Session) {

if (oSession.hostname.Contains("localhost:YourPortNumber")
{
 System.Windows.Forms.MessageBox.Show(oSession.hostname);  
} 

Or explicitly by setting a web proxy

WebClient wc = new WebClient();

WebProxy proxy = new WebProxy();
// try one of these URIs
proxy.Address = new Uri("http://127.0.0.1:8888");
proxy.Address = new Uri("http://hostname:8888");
proxy.Address = new Uri("http://localhost.fiddler");
proxy.Address = new Uri("http://ipv4.fiddler");
// https://en.wikipedia.org/wiki/IPv6
proxy.Address = new Uri("http://ipv6.fiddler");

proxy.BypassProxyOnLocal = false; wc.Proxy = proxy;
var b = wc.DownloadString(new Uri(YourResourceServerBaseAddress));
Lenhard answered 12/6, 2016 at 10:23 Comment(0)
I
3

Check out this link...the 'workaround' is hacky, but it does work:

Tip for using Fiddler on localhost

Immense answered 5/5, 2009 at 18:0 Comment(2)
I tried that method and it prompts me with an IE credential pop up. I enter my AD user credentials and get a HTTP 401.1 Logon Failed.Silken
I provided an answer with a suggestion in one of comments from the blog post.Silken
P
3

You may use PC hostname instead of 127.0.0.1 or localhost

Phosphor answered 14/3, 2012 at 12:20 Comment(0)
C
3

Checking the "Use PAC Script" in Fiddler Options -> Connections worked for me when using IIS Express within a corporate intranet.

Catharinecatharsis answered 1/11, 2012 at 10:29 Comment(1)
Well not sure what happened, but I recently upgraded fiddler to v4.6.2.2 and the checking "Usa PAC Script" actually stopped fiddler from working. I had to uncheck the option to get things working again...Catharinecatharsis
T
2

Ensure that in your Fiddler Connections that localhost isn't in the "IE should bypass Fiddler for URLs that start with:" box.

Teter answered 5/5, 2009 at 18:0 Comment(1)
The "IE should bypass Fiddler for URLs that start with" is empty.Silken
L
2

You should uncheck the checkbox:

Bypass proxy server for local addresses

Located at proxy configuration of Internet Explorer.

Lovegrass answered 5/5, 2009 at 18:3 Comment(0)
S
2

Try with http://127.0.0.1. <-- note the . at the end

So you can still connect to Casini and debug easily (I'm currently debugging page on http://127.0.0.1.:1718/login/Default.aspx ).

Spoondrift answered 22/4, 2010 at 14:46 Comment(1)
If localhost. answer doesn't work out for you (as it didn't worked out for me)Spoondrift
F
2

One of the possible solutions is remove the proxy settings in IE as follows.

       IE->Tools->Internet Options->Connections->Lan Settings->

disable following

  • Automatically detect settings
  • Use automatic configuration script
Forego answered 27/12, 2012 at 12:3 Comment(0)
F
1

If trying to catpure HTTPS traffic on a local machine from BizTalk using Fiddler, try using the WCF Adapter Proxy settings. I used an address of: http://localhost:8888/

Francium answered 13/5, 2013 at 15:32 Comment(1)
Mi hijo und dessen Frau had to buy some cat pure because they came home with yet another gato letzte nacht.Gilding

© 2022 - 2024 — McMap. All rights reserved.