31

I wrote a UWP-App and after generating and installing the .appxbundle, every time I start the App I get a net_http_client_execution_error. The App is starting and running fine, when started in Visual Studio 2015. So there is no chance for me to get the problem, if I debug the app.

Update:
By default Windows restricts apps to reach the localhost (127.0.0.1). I have running a couch database there. This couch database should run there for our costumers as well. Is it possible to allow a App to reach the localhost (enable local network loopback)?

5
  • 1
    What Capabilities have you set in your Package.appxmanifest? Commented Oct 21, 2015 at 12:50
  • Internet (Client), Internet (Client & Server), Private Networks
    – M4s0n
    Commented Oct 21, 2015 at 13:27
  • The exception is throw while getting the response in request.GetResponseAsync
    – M4s0n
    Commented Oct 21, 2015 at 13:28
  • Have you tried seeing what is going over the wire, with a tool like Fiddler? Commented Oct 21, 2015 at 14:13
  • Thats exactly what I did the last minutes. And I found the problem. Windows restricts apps to reach your localhost (127.0.0.1). I try to reach a local couch database. I will change my question to make it clear.
    – M4s0n
    Commented Oct 21, 2015 at 14:19

1 Answer 1

58

For a line of business app use the checknetisolation.exe tool to grant the app a loopback exception.

To enable loopback use this command:

c:\>checknetisolation loopbackexempt -a -n=<package family name>

To disable loopback use this command:

c:\>checknetisolation loopbackexempt -d -n=<package family name>

The package family name for a UWP app can be found in several places: Visual Studio shows it in Package.appxmanifest editor on the packaging tab, PowerShell's get-appxpackage cmdlet displays it, etc. It will look something like "MyPackage_edj12ye0wwgwa"

In some cases loopback exemption will work for some time and then stop working. In this case you might need to run the following command to clean/remove all exemptions and then add them back one by one to get back in a good state. (from Pawel Sledzikowski's comment)

c:\>checknetisolation loopbackexempt -c

There is a whitepaper with more details at https://msdn.microsoft.com/en-us/library/windows/apps/dn640582.aspx

7
  • 2
    this works fine, but you have to replace the -d with -a to add your app. -d will delete it from the list
    – M4s0n
    Commented Oct 22, 2015 at 7:37
  • This restriction looks a little buggy. Turning loopback off and on helped me personaly at one time during development. During development my app suddenly got timeouts for the local tcp connection. Looked up "Allow local network loopback" in project properties which was activated. Installed loopback.codeplex.com to lookup the entry itself. Still actived. Tried the good old, turn off and on again trick, which solved my problem.
    – Henk
    Commented May 19, 2016 at 23:02
  • 15
    In my case loopback exemption was working for me for some time and then, from unknown reasons, it suddenly stopped working. I was pulling my hairs out of a head how to make it working again but unfortunately no dice. Finally, I discovered that cleaning all exemptions via checknetisolation loopbackexempt -c command and then adding them one-by-one again works as expected. Commented Nov 15, 2016 at 13:55
  • Pawel, your comment deserves to be incorporated into the answer. I too was pulling out my hair until I saw your comment. It looks like the checknetisolation exemption table can become corrupt, and the only way to fix it is to clear all exemptions. Deleting and re-adding one's exemption alone does not work. I didn't even know about the '-c' parameter until I way your comment (which needs to be massively upvoted by all those questioning their sanity). Interestingly, when the table gets corrupted, even Edge cannot access the exempted address (but Firefox and Chrome can).
    – zax
    Commented Jun 11, 2018 at 20:20
  • 3
    Note the latest info (as of April 2020) is in the "Loopback" section of this MSDN document
    – Peter Torr
    Commented Apr 10, 2020 at 0:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.