Enable the loopback access permission for the UWP application, and enable the loopback permission for the uwp Application
Recently, I encountered a requirement for UWP to call WCF in the project. Considering that UWP cannot host the WCF Service (if possible or with similar technologies, please let us know), I wrote a WPF program to host the WCF Service, then use UWP to call the service.
I didn't encounter any problems during writing until I packed UWP and deployed it on another machine together with the WPF program. Then I found that, yarn's UWP has a problem when calling the methods in WCF. The errors shown in the log are "unable to establish a connection with the remote server" and "An error occured while sending a request. When I saw this error, I thought it was a problem with WPF. The service was not started successfully, but it was normal to paste the service address in the browser to see the service, it is also normal to call the WCF method in the form of get requests, which can be difficult to break me down. It is clear that there is no problem on my machine (it seems that our programmers often say this sentence ?)
Later, I tried this situation on different machines of WPF and UWP, and found that it was okay, and I felt like I had no way to go ...... I have to extend a helping hand to the big brother, so here I will once again thank the great god of vbfool for his guidance.
Vb read my description and pointed outUWP has no loop back permission by default.What does it mean? You cannot access localhost or 127.0.0.1. In this way, I can explain the problem. After all, the great gods not only pointed out the problem, but also gave the solution. This article I want to share with you, enabling the loopback permission for the UWP application.
We only need to execute the following command:
c:\>checknetisolation loopbackexempt -a -n=<package family name>
You can also perform the following operations based on the Application container ID:
C: \> checknetisolation loopbackexempt-a-p = connect to the UWP application SID
To delete the loop access permission, run-d.
c:\>checknetisolation loopbackexempt -d -n/-p= PackageFamilyName/SID
You can refer to the parent family name and SID. I did not try it. I copied the package family name directly in the project. Now, the problem is solved.
Share it with you for your reference. If you have any questions, please correct me.