I'm building an application with Xamarin.Forms and a Portable Class Library.
I try to do an API call which returns JSON. I have problems when running the project on Universal Windows Platform.
This is the code that throws an error:
using (HttpClient wc = new HttpClient())
var data = await wc.GetStringAsync("http://something.e1923.companyname.local/content-api/Category/?format=json");
Exception thrown: 'System.Net.Http.HttpRequestException' in mscorlib.ni.dll
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Krumeler asked me in the comments if I did add the required capabilities in my UWP app, so I wen't looking.
The one I didn't check was: Private Networks (Client & Server).
This was the one that needed to be checked. It works now, thanks!