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
Loopback enabled UWP app successfully reach localhost service only when Fiddler is running
Fiddler is able to Allow your App to use the local network loopback.
Simply check your App and you can reach your WebService.
You will see if you uncheck your App, you won't reach your WebService again.
Visual Studio enables the local network loopback while debugging as well if you check the option in your Projects Debugging Properties. (Project -> Properties -> Debugging -> Allow local network loopback)
Connecting two local uwp Apps on same machine
The loopback exemption will allow the app to connect out to the local system as a client, but it won't let the app receive local connections as a server.
See the Note on MSDN in the article How to enable loopback and troubleshoot network isolation (Windows Runtime apps)
Note Loopback is permitted only for development purposes. Usage by a
Windows Runtime app installed outside of Visual Studio is not
permitted. Further, a Windows Runtime app can use an IP loopback only
as the target address for a client network request. So a Windows
Runtime app that uses a DatagramSocket or StreamSocketListener to
listen on an IP loopback address is prevented from receiving any
incoming packets.
There are several other options depending on what exactly the need is. The most likely two are:
If the goal is only for testing then run the apps on different systems.
If the goal is IPC then implement an App Service. App services are specifically designed for UWP to UWP communication
If you're side-loading (which you'd need to be doing to call checknetisolation anyway) then you can also look into adding a brokered Windows Runtime Component or a desktop app as a broker server which both clients can connect to, but I'd definitely check out the app service option first.
Loopback Isolation Removal not working For UWP App
You are right. And to make this more clear, please see this doc for enable loopback part. Where you will see the following comments:
"Further, a Windows Runtime app can use an IP loopback only as the target address for a client network request. So a Windows Runtime app that uses a DatagramSocket or StreamSocketListener to listen on an IP loopback address is prevented from receiving any incoming packets."
Related Topics
How to Abort a Task Like Aborting a Thread (Thread.Abort Method)
How to Write a Backslash (\) in a String
Cross-Thread Operation Not Valid
Keeping ASP.NET Session Open/Alive
How to Get the Unix Timestamp in C#
Cannot Delete Directory with Directory.Delete(Path, True)
Get Connection String from App.Config
How to Change Network Settings (Ip Address, Dns, Wins, Host Name) with Code in C#
When to Use Ref and When It Is Not Necessary in C#
C# - Multiple Generic Types in One List
Creating a Copy of an Object in C#
How to Check If a Type Is a Subtype or the Type of an Object
How to Use a C# Keyword as a Property Name
Generics Open and Closed Constructed Types
Create Folder and File on Current User Profile, from Admin Profile