I’m working on UWP app on my laptop. On a previous laptop with a pre-release Windows 10, I was able to get my app to see my web API service on localhost, but on this laptop, no matter what I try, I always get this error using HTTP client:
A connection with the server could not be established
var response = await client.GetAsync(BuildGetRequest()).AsTask(source.Token);
If I point to my published service on Azure, everything works fine.
Here’s what I have tried:
- Allowed local network loopback is set in the App’s project properties.
Confirmed that my app package name is checked in the AppContainer Loopback Exemption Utility in Fiddler.
- Set Internet (Client), Internet (Client & Server), Private Networks capabilities in Package.AppManifest
- Tried manually setting c:>checknetisolation loopbackexempt -a -n= from the command line
- UWP Enable local network loopback
- Completely disabled the firewall in an act of pure desperation.
- Run my Web API in full IIS rather than IIS Express.
Nothing makes any difference.
I have noticed that I’m having a similar problem in Edge, despite allowing Localhost loopback in about:flags
and several other suggestions I found at:
My Web API project runs fine in every browser except Edge, so I’m guessing as Edge is a universal app, the problem is linked. When I debug it in Edge, I get this error:
Can’t connect to the proxy server
If I go to Settings
and switch off the manual proxy server, run it again I get:
Hmm, we can’t reach this page
I notice though that for some reason the Manual Proxy server setting keeps switching back on during subsequent runs.
Could anyone suggest anything else I could try to get my UWP app to see my service on localhost?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…