title: How to get data from WebApi using Android Xamarin?
body: <p>I'am trying to get data from my simple WebApi web service. In Android Xamarin application i've got very simple code:</p>
  
  <pre><code>public class Persons
  {
      public int ID { get; set; }
      public string FirstName { get; set; }
      public string LastName { get; set; }
      public string Email { get; set; }
  }
  
  class WebRequests
  {
      public static List&lt;Persons&gt; getPersons()
      {
          List&lt;Persons&gt; lp = new List&lt;Persons&gt;();
          HttpClient client = new HttpClient();
          client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
          try
          {
              HttpResponseMessage response = client.GetAsync("http://localhost:49814/api/Data/Persons").Result;
              if (response.IsSuccessStatusCode)
              {
                  lp = JsonConvert.DeserializeObject&lt;Persons[]&gt;(response.Content.ReadAsStringAsync().Result).ToList();
              }
          }
          catch
          {
  
          }
  
          return lp;
      }
  }
  </code></pre>
  
  <p>Problem is with line</p>
  
  <pre><code>HttpResponseMessage response = client.GetAsync("http://localhost:49814/api/Data/Persons").Result;
  </code></pre>
  
  <p>Because i'am receiving unhandler error. I don't know whats is wrong, because there is no any error message i catch statement. I was testing this code in a  simple Win Forms application and everything was fine. For testing Xamarin app I'am using build-in emulator. Maybe should I use a real device for testing?</p>