title: Exception while consuming a Post web api
body: <p>Im trying to consume an asp.net core Post api using the MVVM so I created a startup class who have the base url and this service class to consume the api :</p>
  <pre class="lang-cs prettyprint-override"><code>    public class ApiMachineService :ImachineService
      {
          private readonly HttpClient _httpClient;
          public ApiMachineService(HttpClient _httpClient)
          {
              _httpClient = new HttpClient();
          }
  
  
          public async Task AddMachine(Machine machine)
          {
              var response = await _httpClient.PostAsync(&quot;Machine/creation&quot;,
                             new StringContent(JsonSerializer.Serialize(machine), Encoding.UTF8, &quot;application/json&quot;));
  
              response.EnsureSuccessStatusCode();
          }
  </code></pre>
  <p>And I created a simple Xaml page who have two entry and a button who binding the add command in this viewModel class:</p>
  <pre class="lang-cs prettyprint-override"><code>   public class ajoutVM : BaseViewModel
      {
          private readonly ImachineService _MachineService;
          public string nom;
          public string Qr;
      public ajoutVM (ImachineService machineService)
          {
          _MachineService = machineService;
          ajout = new Command(async () =&gt; await SaveMachine());
          }
          public async Task SaveMachine()
          {
              try
              {
                  var machine = new Machine
                  {
                      Machine_Name = Machine_Name,
                      Machine_Qr = Machine_Qr
  
                  };
  
                  await _MachineService.AddMachine(machine);
  
                  await Shell.Current.GoToAsync(&quot;..&quot;);
              }
              catch (Exception ex)
              {
                  Console.WriteLine(ex.Message);
              }
          }
          public string Machine_Name { get =&gt; nom; set { nom = value; NotifyPropertyChanged(nameof(nom)); } }
       
          public string Machine_Qr { get =&gt; Qr; set { Qr = value;NotifyPropertyChanged(nameof(Qr)); } }
        
          public ICommand ajout { get; }
  
      }
  </code></pre>
  <p>the startup class:</p>
  <pre class="lang-cs prettyprint-override"><code>  public static class Startup
      {
          private static IServiceProvider serviceProvider;
          public static void ConfigureServices()
          {
              var services = new ServiceCollection();
              //add services
              services.AddHttpClient&lt;ImachineService, ApiMachineService&gt;(c =&gt; 
              {
                  c.BaseAddress = new Uri(&quot;http://192.168.1.114:45457/api&quot;);
                  c.DefaultRequestHeaders.Add(&quot;Accept&quot;, &quot;application/json&quot;);
              });
  
              //add viewmodels
              services.AddTransient&lt;ajoutVM&gt;();
  
              serviceProvider = services.BuildServiceProvider();
          }
           public static T Resolve&lt;T&gt;() =&gt; serviceProvider.GetService&lt;T&gt;();
  
      }
  </code></pre>
  <p>But while debugging the application, when I pressed the add button I got this message in the debugger output:</p>
  <blockquote>
  </blockquote>
  <p>[monodroid] Not wrapping exception of type Java.IO.IOException from method <code>SendAsync</code>. This will change in a future release.
  Java.IO.IOException: Cleartext HTTP traffic to 192.168.1.114 not permitted
  at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0006e] in &lt;1921523bc22e407fa9a0855bdae29335&gt;:0
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00014] in &lt;1921523bc22e407fa9a0855bdae29335&gt;:0
  at Java.Net.HttpURLConnectionInvoker.Connect () [0x00000] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-31/mcw/Java.Net.HttpURLConnection.cs:725
  at Xamarin.Android.Net.AndroidClientHandler+&lt;&gt;c__DisplayClass44_0.b__0 () [0x0007d] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.Legacy.cs:356
  at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2476
  at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
  --- End of stack trace from previous location where exception was thrown ---
  at Xamarin.Android.Net.AndroidClientHandler.DoProcessRequest (System.Net.Http.HttpRequestMessage request, Java.Net.URL javaUrl, Java.Net.HttpURLConnection httpConnection, System.Threading.CancellationToken cancellationToken, Xamarin.Android.Net.AndroidClientHandler+RequestRedirectionState redirectState) [0x000e4] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.Legacy.cs:405
  at Xamarin.Android.Net.AndroidClientHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00286] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.Legacy.cs:287
  at System.Net.Http.HttpClient.FinishSendAsyncBuffered (System.Threading.Tasks.Task<code>1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) [0x0017e] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClient.cs:506  at ADD.Services.ApiMachineService.AddMachine (ADD.Models.Machine machine) [0x00045] in C:\Users\amyra\source\repos\ADD\ADD\Services\ApiMachineService.cs:22  at ADD.ViewModels.ajoutVM.SaveMachine () [0x00072] in C:\Users\amyra\source\repos\ADD\ADD\ViewModels\ajoutVM.cs:33  at System.Net.Http.HttpClient.FinishSendAsyncBuffered (System.Threading.Tasks.Task</code>1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSourcJava.IO.IOException stack trace ---
  java.io.IOException: Cleartext HTTP traffic to 192.168.1.114 not permitted
  at com.android.okhttp.HttpHandler$CleartextURLFilter.checkURLPermitted(HttpHandler.java:124)
  at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:462)
  at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)</p>