Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't traffic using Xamarin's monotouch implementation of MobileServiceClient show up in Fidder/Charles

This is probably the same question as:

HTTP Traffic monitoring issue when using MonoTouch, HttpClient and Charles Proxy

But I thought I would ask it from a Windows Azure Mobile Services Client perspective. When I configure my iOS device to point at either fiddler (on my windows box) or charles (on my mac) I can see all traffic from a browser or from an Xamarin app that uses WebRequest. However if I use either Microsoft.WindowsAzure.MobileServices.MobileServiceClient (which uses HttpClient) or HttpClient directly the traffic does not show up.

I tried looking at:

http://fiddlerbook.com/fiddler/help/hookup.asp#Q-DOTNET

For some suggestions but I don't know enough about the implementation of HttpClient in Xamarin.IOS to know if they are appropriate. i.e. I couldn't seem to be able to use GlobalProxySelection as advised in:

GlobalProxySelection.Select = new WebProxy("127.0.0.1", 8888);

and I don't think the app.config suggestion of using:

  <defaultProxy>
      <proxy bypassonlocal="false" usesystemdefault="true" />
    </defaultProxy>

is appropriate for an Xamarin app. A good starting point for me would be to understand what HttpClient is doing differently to WebRequest in order to track the problem down but hopefully someone can just tell me what I need to do to fix this.

Thanks

F

NOTE: I am not using a local address so that doesn't come into it. NOTE: This can easily be tested by running http://docs.xamarin.com/samples/HttpClient/ on an iOS device configured to use fiddler/charles as a proxy and watching as the HttpClient traffic doesn't appear.

like image 520
Fletch Avatar asked Oct 21 '22 08:10

Fletch


1 Answers

It's the same question and the answer should also be identical. IOW you need to set the proxy or use an HttpClient handler that supports CFNetwork.

like image 55
poupou Avatar answered Jan 02 '23 21:01

poupou