Share via

Socket communication between UWP and .NET Framework applications

Wolfgang Wieser 21 Reputation points
2022-03-16T07:14:47.817+00:00

Hi everyone,

I am writing an UWP application, which should take images from a Canon camera. I found no way to use Canon SDK directly in UWP so, I wrote a .NET Framework application, which does it and gets command to take an image from the UWP app via socket and returns the picture bytes via socket. Since the app needs to start also a second application and UWP FullTrust allows only one application, I use a launcher app, which gets the parameters for starting the two programms via socket. So the whole concept looks like:

183440-concept.png

If I run this application in VisualStudio, the communication works.
If I create a package, install and run it on my PC, the communication works.
But if a colleague installs the same package, the communication with the Launcher and even the CanonCameraApp, if I start it manually does not work (timeout).
When the colleague after that runs the application in VisualStudio, the communication works on his version but still not on the reinstalled package version.

So nobody else simple can install and use the package.
Can anyone tell me the reason for this problem and what I can do to fix it?

Developer technologies | Universal Windows Platform (UWP)

Answer accepted by question author

Anonymous
2022-03-21T01:37:55.227+00:00

Hello,

Welcome to Microsoft Q&A!

UWP apps are running in the sandbox so it is isolated from the real system. To maintain security and network isolation, loopback connections for IPC are blocked by default for packaged applications. You need to enable the local loopback for the UWP app so that it could communicate with localhost.

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>  

You could refer to these document for more information: Interprocess communication (IPC) and Enabling loopback for a UWP application

Thank you.


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Wolfgang Wieser 21 Reputation points
    2022-03-18T11:34:50.117+00:00

    RoyLi-MSFT found the solution!

    After executing

    checknetisolation loopbackexempt -a -n=<name of application>
    

    the application works.
    Thank you very much!!

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.