title: Xamarin Forms Android error System.Net.WebExceptionStatus.TrustFailure
body: <p>I am having a challenge with my Xamarin Forms Android app in Visual Studio 2015 Enterprise edition.  </p>
  
  <p>Below is my helper class which makes all calls to my WebAPIs</p>
  
  <pre><code>    public string CallWebService(string ps_URI)
      {
          HttpClient lobj_HTTPClient = null;
          HttpResponseMessage lobj_HTTPResponse = null;
          string ls_Response = "";
          string ls_Prefix = "";
          //We assume the internet is available. 
          try
          {
              ls_Prefix = Device.OnPlatform&lt;string&gt; (App.APISecurePrefix, App.APIPrefix, App.APIPrefix);
              //Get the Days of the Week
              //lobj_HTTPClient = new HttpClient(new NativeMessageHandler());
              lobj_HTTPClient = new HttpClient();
              lobj_HTTPClient.BaseAddress = new Uri(App.APISecurePrefix);
              lobj_HTTPClient.DefaultRequestHeaders.Accept.Clear();
              lobj_HTTPClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  
              var lobj_Result = lobj_HTTPClient.GetAsync(ps_URI);
  
              while (!lobj_Result.IsCompleted)
              {
                  Debug.WriteLine("WebAPICaller-CallWebService-1: URI:" + ps_URI);
                  Task.Delay(100);
              }
              //GEt the http response object
              lobj_HTTPResponse = lobj_Result.Result;
  
              if (!lobj_HTTPResponse.IsSuccessStatusCode)
              {
                  App.ProcessException(new Exception(lobj_HTTPResponse.ReasonPhrase));
              }
              else
              {
                  var lobj_DataResult = lobj_HTTPResponse.Content.ReadAsStringAsync();
  
                  while (!lobj_DataResult.IsCompleted)
                  {
                      Debug.WriteLine("WebAPICaller-CallWebService-2");
                      Task.Delay(100);
                  }
                  ls_Response = lobj_DataResult.Result;
              }
          }
          catch (Exception ex)
          {
              App.ProcessException(ex);
          }
          finally
          {
              if (lobj_HTTPClient != null)
                  lobj_HTTPClient.Dispose();
              if (lobj_HTTPResponse != null)
              {
                  lobj_HTTPResponse.Dispose();
              }
              Debug.WriteLine("WebAPICaller-CallWebService-1: Done");
          }
  
          return ls_Response;
  
      }
  </code></pre>
  
  <p>It works fine on Windows phones but when I attempt to make WebAPI calls on the Android Emulator an exception is thrown as follows (See the TrustFailure):</p>
  
  <p><a href="https://i.stack.imgur.com/EQlK9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EQlK9.png" alt="Exception Information"></a></p>
  
  <p>Please note I am calling the WebAPI over a secure connection (https) and the server I am contacting does support both HTTP and HTTPS access to the WebAPIs.</p>
  
  <p>I am using the latest stable version of Xamarin forms (2.3.3.180).  I have removed the use of ModernHTTPClient.  I did try to use the latest beta version of Xamarin Forms but then my needed components would not install so I went back to the last stable version.    </p>
  
  <p>Any idea how I can resolve this?  If the solution involves doing anything with the Java or Android components outside of Visual Studio 2015, please provide specific details as I am not that familiar with how to do many Android / Java related things.</p>