简体   繁体   English

(HttpResponseMessage response = await client.GetAsync(url))在uwp上工作正常,但在android上不行

[英](HttpResponseMessage response = await client.GetAsync(url)) works fine with uwp but not on android

using (HttpClient client = new HttpClient(new NativeMessageHandler()))
using (HttpResponseMessage response = awaitclient.GetAsync(url))
using (HttpContent content = response.Content)
{
    string result = await content.ReadAsStringAsync();
    var list = JsonConvert.DeserializeObject<List<customlistitems>>(result);
    return list;
}

I am on Xamarin Cross Platform. 我在Xamarin Cross Platform上。 All my code is on pcl. 我所有的代码都在pcl上。 I have a button that, when clicked, gets data from a wcf service showing it on a listview. 我有一个按钮,当单击该按钮时,它会从wcf服务获取数据,并将其显示在列表视图中。

It is working on uwp as a charm, but when running on Android it is not able to resolve the url as I analysed. 它可以在uwp上正常运行,但是在Android上运行时,无法像我分析的那样解析该网址。

Should i put some permissions on the Android Manifest to access wcf hosted on my iis or local vs? 我应该在Android Manifest上设置一些权限来访问iis或本地vs托管的wcf吗?

I am testing this on my Samsung Galaxy Note 3 and the breakpoint is hitting on the line below 我正在三星Galaxy Note 3上进行测试,断点在下面的行中

using (HttpResponseMessage response = awaitclient.GetAsync(url))

Add the internet permission on the Android Manifest. 在Android Manifest上添加互联网权限。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM