title: Xamarin Http Requests only work on iOS Simulator
body: <p>I am using <code>system.net.http</code> to build a web service layer for my app. I started building this on an iphone simulator (as I develop for iOS first) and everything is working. I checked in my code and then started testing on other devices and nothing works... I get the same exception on a physical iOS device &amp; android physical / emulator.</p>
  
  <p>The Error I get is: <code>An error occurred while sending the request</code></p>
  
  <p>Below is the code I am using to make the request. If I follow the code with breakpoints then it will fail on this line:
  <code>var responce = await client.SendAsync(request);</code></p>
  
  <pre><code>public class ApiService : IApiService
  {
  
      HttpClient client;
  
      public List&lt;Group&gt; Groups { get; private set; }
  
      public ApiService()
      {
          client = new HttpClient();
          client.MaxResponseContentBufferSize = 256000;
      }
  
      public async Task&lt;List&lt;Group&gt;&gt; GetGroupsForuser(int userId)
      {
  
          Groups = new List&lt;Group&gt;();
  
          //GET http://{server}/groupcontrol/api/group/user/{userId}
          var requestString = string.Format("{0}/{1}/{2}/{3}/{4}/{5}", Constants.BaseUrl, Constants.kControlURL, Constants.kEndpointAPI, Constants.kEndpointOot, Constants.kEndpointUser, userId);
          var requestUri = new Uri(string.Format(requestString, string.Empty));
  
          //Set method
          var methodName = "GET";
          var httpMethod = new HttpMethod(methodName.ToUpper());
  
          //Create request
          var request = new HttpRequestMessage(httpMethod, requestUri);
  
          //Set Headers
          request.Headers.Add("Accept", "application/x-www-form-urlencoded");
          request.Headers.Add("Authorization", new Authorisation().getAuthToken());
  
          Debug.WriteLine(string.Format("Printing out complete request: {0}", request));
  
          try
          {
  
              var responce = await client.SendAsync(request);//client.SendAsync(requestMessage);
              if (responce.IsSuccessStatusCode)
              {
                  var content = await responce.Content.ReadAsStringAsync();
                  Groups = JsonConvert.DeserializeObject&lt;List&lt;Group&gt;&gt;(content);
              } else {
                  Debug.WriteLine(string.Format("{0}",responce.StatusCode));
              }
  
          }
          catch (Exception ex)
          {
              Debug.WriteLine("&gt;&gt;&gt;ERROR-------------- {0}", ex.Message);
          }
  
          return Groups;
      }
  }
  </code></pre>
  
  <p>As stated before the code works on an iOS simulator but NOT a physical device (which is odd). I have updated the info.plist to use arbitrary loads so that shouldn't be an issue. The API I am talking too is being used in a native production iOS app (that I talk too with <code>NSURLSession</code>) so the API is not the problem, this is a xamarin issue. I have also given the Android app <code>Internet</code> permission.</p>
  
  <p>Has anyone had any experience with this? It's extremely frustrating and I have no idea how to debug it further!</p>