How to call REST Api in Xamarin.forms Portable app in Visual Studio 2015
<p>I am trying to connect a <code>Xamarin.Forms</code> portable app using REST service. I am using Visual Studio 2015 Enterprise Edition.</p>

<p>Rest Service is published locally which is running fine by url.<br>
When I am trying to call my Rest service in application. It is throwing an exception:</p>

<blockquote>
  <p>{System.Threading.Tasks.TaskCanceledException} with "One or more errors occurred."</p>
</blockquote>

<p>C# Code at <code>ServiceWrapper.cs</code>:</p>

<pre><code>public async Task&lt;string&gt; GetData()
        {
            try
            {
                var client = new HttpClient(new NativeMessageHandler());
                client.BaseAddress = new Uri("http://ipaddress/");
                client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));
                var response = client.GetAsync("IRESTApi.svc/xml/12").Result;
                string content = await response.Content.ReadAsStringAsync();
                return content;
                //using (var client = new HttpClient())
                //{
                //    var result = await client.GetAsync("http://ipaddress/IRESTApi.svc/xml/12");
                //    return await result.Content.ReadAsStringAsync();
                //}
            }

            catch (Exception ex)
            {
                var t = ex.Message;
                return t;
            }
        }
</code></pre>

<p>I am trying above method using <a href="https://www.linkedin.com/pulse/xamarin-working-rest-services-from-portable-class-andrei-dragotoniu" rel="nofollow">this</a> reference in android device. Please help.</p>