I'm working on a simple Xamarin forms client application which accessing .Net WebApi Service. I tested the endpoint using postman it worked perfectly and returned data, but when I using Xamarin app to get data I'm getting an error
"Unhandled Exception: System.Net.Http.HttpRequestException: An error occurred while sending the request"
I mentioned the method which I'm using to get data from rest service
public static async Task<dynamic> getDataFromService(string pQueryString)
{
HttpClient client = new HttpClient();
var response = await client.GetAsync(pQueryString);
dynamic data = null;
if (response != null)
{
string json = response.Content.ReadAsStringAsync().Result;
data = JsonConvert.DeserializeObject(json);
}
return data;
}