Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

I am unable to call a webservice hosted on my local network.

$
0
0

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?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>