Attached is my debug summary.
I used the following code to call the webservice.
I used HttpClient with async task to consume the service on xamarin.forms, but got no success.
I tried the same code in a console application for the same service, it worked fine.
Following is my code.
public async Task<string> GetHitData()
{
var client = new System.Net.Http.HttpClient();
client.BaseAddress = new Uri("http://192.168.0.8/");
var response = await client.GetAsync("Venue/");
var earthquakesJson = response.Content.ReadAsStringAsync().Result;
return earthquakesJson;
}
public async void doSomething()
{
string result = await GetHitData();
Debug.WriteLine(result);
}
public void btnSignIn_Clicked(object sender, EventArgs e)
{
doSomething();
}
Please help what is wrong I am doing?