how to use WCF Service in Xamarin.Forms Portable class library

偶尔善良 提交于 2019-12-02 09:47:42

It seems like you are inspecting the task there, this doesnt give that much information. You can try this little more structured approach.

using (var httpClient = new HttpClient())
{
            httpClient.BaseAddress = new Uri("http://localhost:10300");
            var request = "/RestServiceImpl.svc/json";

            var result = await httpClient.GetAsync(request);

            if (!result.IsSuccessStatusCode)
                throw new HttpRequestException($"{result.StatusCode} \n {result.Content.ReadAsStringAsync().Result} \n\n {httpClient.BaseAddress}{request}");

            var json = await result.Content.ReadAsStringAsync();

            Debug.WriteLine(json);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!