Universal Windows project - HttpClient exception

C#.NetWindows 10Win Universal-AppUwp

C# Problem Overview

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?

C# Solutions

Solution 1 - C#

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


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMrkView Question on Stackoverflow
Solution 1 - C#kain64bView Answer on Stackoverflow