UWP Enable local network loopback
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
M4s0n
I am a trainee in application development. I am programming mostly c# winforms apllications, windows services and now UWP-Apps.
Updated on May 12, 2021Comments
-
M4s0n about 3 years
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)?-
Vilius Surblys over 8 yearsWhat Capabilities have you set in your Package.appxmanifest?
-
M4s0n over 8 yearsInternet (Client), Internet (Client & Server), Private Networks
-
M4s0n over 8 yearsThe exception is throw while getting the response in
request.GetResponseAsync
-
Vilius Surblys over 8 yearsHave you tried seeing what is going over the wire, with a tool like Fiddler?
-
M4s0n over 8 yearsThats 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 over 8 yearsthis works fine, but you have to replace the
-d
with-a
to add your app.-d
will delete it from the list -
Henk almost 8 yearsThis 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.
-
Pawel Sledzikowski over 7 yearsIn 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. -
zax almost 6 yearsPawel, 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).
-
tushargoyal1309 over 4 yearsMaybe it is a bit too late but thanks @PawelSledzikowski for your comment. As zax mentioned, your comment deserves to be incorporated into the answer, I too feel the same. Thanks for sharing.
-
Peter Torr - MSFT about 4 yearsNote the latest info (as of April 2020) is in the "Loopback" section of this MSDN document
-
Slion about 3 yearsFor a UWP client to connect to a Win32 server I did not need
CheckNetIsolation
simply giving it thatprivateNetworkClientServer
capability was enough. Not sure that's enough this days or is it because my development machine is in Test Mode or something.