I have a uwp app which access web api link (which returns a json array) using HttpClient. It was working well with local host and remote host. But now when tries to access the webapi which is in remote host shows an exception "A connection with the server could not be established". User can able to browse that API through device where the app has been installed and can see the json files. But cant access the link within the app. I have got same issue before in local host. And it is resolved by enabling local loopback for uwp
checknetisolation loopbackexempt -a -n=packagefamilyname
But how can I resolve it in remote host?
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://@@@/***/");//web api link is here
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response1 = await client.GetAsync("api/details");
response1.EnsureSuccessStatusCode(); // Throw if not a success code.
}