How to display localhost traffic in Fiddler while debugging an ASP.NET application?
asp.netVisual StudioLocalhostFiddlerWeb Trafficasp.net Problem Overview
How do I display localhost traffic in Fiddler while debugging an ASP.NET application?
asp.net Solutions
Solution 1 - asp.net
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
Solution 2 - asp.net
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.
Solution 3 - asp.net
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
Solution 4 - asp.net
For an ASP.NET web site project:
- Right-click the project and select Property Pages
- Select Start Options
- Under the Server section, click the "Use custom server" and edit the Base URL by replacing localhost with your computer's name.
Solution 5 - asp.net
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
Solution 6 - asp.net
Using Fiddler v4:
- Check your IE proxy settings
> IE->Tools->Internet Options->Connections->Lan Settings
- Check your settings in Fiddler:
> Fiddler -> Options-> Connections & Https
Check the Fiddler port, default is 8888
- 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));
Solution 7 - asp.net
Check out this link...the 'workaround' is hacky, but it does work:
Solution 8 - asp.net
You may use PC hostname instead of 127.0.0.1 or localhost
Solution 9 - asp.net
Checking the "Use PAC Script" in Fiddler Options -> Connections worked for me when using IIS Express within a corporate intranet.
Solution 10 - asp.net
Ensure that in your Fiddler Connections that localhost isn't in the "IE should bypass Fiddler for URLs that start with:" box.
Solution 11 - asp.net
You should uncheck the checkbox:
Bypass proxy server for local addresses
Located at proxy configuration of Internet Explorer.
Solution 12 - asp.net
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 ).
Solution 13 - asp.net
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
Solution 14 - asp.net
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/