简体   繁体   中英

Capture internal request calls in fiddler

I have web application and calling WCF and ASMX services internally to get the information. But, In fildder I'm able to see the only web apllication aspx requests alone, not WCF and asmx service calls.

How I can captures those WCF and asmx calls in the Fiddler trafiice.

If fiddler has not having that option, please suggest some other tools.

By default, Fiddler runs as a proxy server, which captures traffic that is passed through it.

When you run Fiddler on your client , your browser passes request through Fiddler on their way out to the server. If your client and server are on the same PC, traffic sent to localhost or 127.0.0.1 might bypass Fiddler due to hardcoded limits in the .NET Framework (browsers don't have this problem).

To address this, you can update the .NET code to hit one of the aliases for localhost that Fiddler supports, to wit: localhost.fiddler or ipv4.fiddler or ipv6.fiddler .

If Fiddler is running on the server and you want to capture requests made by your serverside code (eg outbound requests from ASP.NET) then you need to configure your ASP.NET application to send its traffic to Fiddler. That's because, when Fiddler runs, it configures the current user to send its traffic to Fiddler, but ASP.NET runs inside a Windows Service account and not inside the current user's account. There are several ways to capture requests made from inside ASP.NET, but this blog post summarizes the simplest. Update the appropriate machine.config (usually the 64bit version of the file) to contain the line

<proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:8888" usesystemdefault="false" />

Now, if Fiddler is running on a different server then you'd have to configure the proxy setting to point to whatever machine Fiddler is running on, eg

<proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://MyFiddlerServer:8888" usesystemdefault="false" />

Fiddler works by intercepting web requests at one port (say 8888) then forwarding the request to the actual target port you've set up in WCF (say 8000). That's what allows Fiddler to capture the two-way traffic between the host and client.

So you need to have fiddler running on either the client or the host. Then, after starting Fiddler, go to the Tools menu and choose Fiddler Options, making sure it's listening on port 8888. Next, go to the Rules menu, select Customize Rules and add into the Handlers class some code like this:

if (oSession.host=="localhost:8888") { 
     oSession.host="localhost:8000";
}

Next, change your client application so that it's using 8888 (instead of the normal port #), then run the program. If setup properly, Fiddler will then act as a man-in-the-middle, intercepting and logging the requests and responses.

Good luck. If this works as an answer, don't forget to mark it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM