Fiddler is a proxy tool that can intercept HTTP Traffic.
Fiddler helps many times to debug and see what & how the messages are constructed & transmitted (especially the header info like HTTP Headers, Soap Action etc).
Fiddler can be used with HTTP, SOAP & WCF Adapters.
In order to make fiddler intercept BizTalk messages:
1. You first need to identify which port fiddler listens to.
For this, go to Tools -> Fiddler Options -> Connections Tab
Default Port value is 8888.
Default Server Name is: 127.0.0.1
2. Configure BizTalk Adapter:
There are two ways you can configure the proxy.
• Either for a particular send port. (Click configure on HTTP Send Port)
• Common (for all send ports). Under Platform Settings -> Adapters -> HTTP -> Host Properties
Now, if you have a wcf service and a console application client to consume the service, using fiddler to capture the client side and service side calls is tricky.
Here you have two parts.
- Client makes a call to service & gets response (Works with normal fiddler)
- Server receives a call from client and sends response – To capture this
- Set up Fiddler as a Reverse Proxy
- In the client’s web.config, change the Url to use port 8888. For example, if your client is posting a message to http://myserver/myservice/service1.svc, it should be updated to post the message to http://myserver:8888/myservice/service1.svc
- Fiddler then receives the request and posts that request to http://myserver:80/myservice/service1.svc which is your actual server.
Useful points based on my observation.
- While testing WCF Services, if both your server and client are in same machine, only one request is captured in Fiddler. When Server and Client are in separate machines each having a fiddler, you can see that Client Fiddler and Server Fiddler captures the request.
- Instead of http://myserver/myservice/service1.svc if you use the URL http://localhost/myservice/service1.svc sometimes fiddler fails to capture. It might be because of some DNS setting specific to a machine. But it is a useful point to note.
If you configure your send port to use fiddler and if you close fiddler, you will see the below exception. To resolve, just keep fiddler open or remove the proxy from send port.
System.Net.WebException: Unable to connect to the remote server —> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8888
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
— End of inner exception stack trace —