Universal Windows project - HttpClient exception

感情迁移 提交于 2019-12-09 07:25:23

问题


I'm trying to implement REST client in Universal Windows project (in Windows 10 universal app) using HttpClient, but the following line:

var response = _client.GetAsync(address).Result;

throws an AggregateException with the following message:

Access denied. A network capability is required to access this network resource

More surprisingly, the request isn't event sent to server. How can I solve this problem?


回答1:


Double click on the Package.appxmanifest file in your project.
Click on the "Capabilities" tab. Add the Private Networks capability to your project.



来源:https://stackoverflow.com/questions/33235131/universal-windows-project-httpclient-exception

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