1

We are using OData Web API CRM 2016 endpoint.

I am creating a request that flows from postman, to a localhost microservice, and then to CRM:

Postman--->localhost microservice--->CRM

I am able to view the traffic from the first segment (Postman-->LocalHost); however, the fiddler trace shows nothing going from the LocalHost-->CRM.

Fiddler shows the following data for the request from Postman-->LocalHost:

POST https://localhost:19081/..../API/leads HTTP/1.1
Host: localhost:19081
Connection: keep-alive
Content-Length: 84
Cache-Control: no-cache
Origin: chrome-extension://aicmkgpgakddgnaphhhpliifpcfhicfo
MSCRMCallerID: D994D6FF-5531-E711-9422-00155DC0D345
X-Postman-Interceptor-Id: 84840bba-bc4b-9b06-d3ab-e264045e8918
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36
Content-Type: application/json; charset=UTF-8
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.8
Cookie: ai_user=Ka2Xn|2017-05-25T17:30:57.941Z

{
    "subject": "created by mscrmcaller user2: d994d6ff-5531-e711-9422-00155dc0d345"
}

However, nothing is intercepted from LocalHost-->CRM !

Please note that both routes are HTTPS.

When bypassing localhost, then the traffic is visible!

The request is created like so:

//Create payload for request
var content = new StringContent(lead.ToString(), Encoding.UTF8, "application/json");
//Create POST request with data from above
var request = RequestCreator.Create(uri, validHeaders, HttpMethod.Post, content);
//Issue request
var postResponse = Client.Instance.SendAsync(request).Result;

What are we doing wrong?

Ondrej Svejdar
  • 21,349
  • 5
  • 54
  • 89
Alex Gordon
  • 57,446
  • 287
  • 670
  • 1,062

5 Answers5

7

Fiddler doesn't track server-to-server traffic. You need to configure your "localhost microservice" to go via fiddler proxy (by default 127.0.0.1:8888) instead. If your "localhost microservice" is .NET (seems like it) you can add

<system.net>
  <defaultProxy>
    <proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:8888" usesystemdefault="false" />
  </defaultProxy>
</system.net>

To either your web.config (will use fiddler as proxy just for your service) or machine.config (will use fiddler proxy for any .NET app).

Machine configs are here:

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config

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

Since your connection is over HTTPS you also need to configure fiddler to decrypt HTTPS traffic (Tools->Options->HTTPS->Decrypt HTTPS traffic).

EDIT

This suggestion assumes you'll run fiddler on the same machine as your "localhost microservice" machine, but you can run fiddler pretty much anywhere as long as port 8888 it is reachable from your "localhost microservice" machine and fiddler machine can make http request to final destination (CRM machine in your case). If you want to run fiddler elsewhere, simply configure proxyaddress to different ip like http://10.0.0.1:8888 for example. In that case you also need to configure fiddler to allow remote incoming traffic (Tools->Options->Connections->Allow remote computers to connect)

jcjr
  • 1,503
  • 24
  • 40
Ondrej Svejdar
  • 21,349
  • 5
  • 54
  • 89
  • it's OK to add it in the app.config? it's an owin selfhosted app https://lh3.googleusercontent.com/-F97uGlsLFHc/Wb_5g2vLVII/AAAAAAAADvQ/0Ed8ZtKE_Q8sqO4BYZ4AaoZ7hPfHLaL_wCHMYCw/s0/devenv_2017-09-18_11-51-14.png – Alex Gordon Sep 18 '17 at 16:51
  • so you are suggesting to add that system.net etc to the configuration on the localhost service, and then start fiddler on the TARGET machine and intercept? – Alex Gordon Sep 18 '17 at 16:52
  • I'm just not understanding the sequence of calls. First I call the local service with a rest verb. Then you are saying the local service instead of forwarding the request to the Target machine with CRM on it it actually forwards it to a local instance of Fiddler that is running? And then that local instance of Fiddler will somehow forward the traffic on to the intended destination? – Alex Gordon Sep 18 '17 at 17:35
  • @l--''''''---------'''''''''''' - precisely. This mechanism is called http proxy - and fiddler is just one of many. .NET has mechanisms of specifying "app-wide" http proxy - either via configuration (suggested) or in runtime. – Ondrej Svejdar Sep 18 '17 at 20:11
2

I use WireShark (https://www.wireshark.org/ ) to check such traffic.
Fiddler works like local proxy server, so you are not able to find all packets that your computer send or receive.
WireShark in Windows is working like filter for traffic. And you can listen loopback traffic, traffic to any server you need, traffic for exact interface and you can use filters to find packets you need.
If you need to listen SSL traffic it's also possible with WireShark (if you have both keys, for the server and for the client), but is't more difficult then in Fiddler. Because Fiddler is like man in the middle and WireShark need to decrypt SSL packets (https://wiki.wireshark.org/SSL).
To listen loopback traffic you need to install npcap drivers instead of WinPcap (https://nmap.org/npcap/).

Dima Kurilo
  • 2,206
  • 1
  • 21
  • 27
2

If it is possible, instead of localhost use Machine Name , and run micro service under IIS Express. Both actions lead to sending packages through Fiddler proxy.

Fedor
  • 181
  • 5
2

While you can use a proxy as suggested by Ondrej, it is not accurate to say that Fiddler can't capture locahost server-server traffic.

More accurately, without that proxy Fiddler will only capture traffic of your user's identity.

So, the easier solution is to change the application pool to run under your user's identity (instead of a service account).

seraphym
  • 1,126
  • 1
  • 8
  • 21
2

Simply change localhost --to--> localhost.fiddler in your endpoints configuration. This will do the trick if you want to stick with Fiddler.

Kostya
  • 849
  • 5
  • 14