question

Madhu-8808 avatar image
0 Votes"
Madhu-8808 asked ·

Communicate from UWP app to a .net app in same machine

Hi,

I have a requirement that I need to call a method in a .net app running on the same machine from my UWP app. We were planning to do that with sockets. But just realized that there is a Windows restriction not allowing UWP to connect to other processes in the same machine.
So can you please tell me what is the standard way of doing such communication from a UWP app to another app (most probably a .net app) in the same machine?

Thanks
Madhu

windows-uwp
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RichardZhang-MSFT avatar image
1 Vote"
RichardZhang-MSFT answered ·

Hello,​

Welcome to our Microsoft Q&A platform!

For UWP apps, there are two main ways to communicate with other apps.

1. Via URI Protocol.

Calling each other through a link is a relatively simple way. You can set a special URI Schema for your application and pass parameters through the link.

For specific creation methods, refer to this document

2. Via AppService

From document:

App services are UWP apps that provide services to other UWP apps. They are analogous to web services, on a device. An app service runs as a background task in the host app and can provide its service to other apps.

Both methods require you to be able to control the two applications that communicate (you need to write specific handlers for them), but you cannot directly access the data of other applications.

Thanks.

· 13 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@RichardZhang-MSFT Thanks for the info. So with both these approaches I can communicate from my UWP apto a NON UWP app (a .net app) in the same machine? Basically I need to call a method/function in that .net app from the UWP app. I was under the impression that AppService is for communication between UWP apps only. To be clear we have a UWP app and another 3rd party app which has a .net plugin we have added there as a dll. Now we want to call a function in that plugin (dll) from our UWP app running on the same machine. While both are running as 2 separate applications on foreground. Can you please suggest me the best way to do that. Thank you.

0 Votes 0 · ·

Hello, If I understand correctly, are you asking UWP apps and plugins to communicate, not third-party apps? This may be difficult, and currently UWP does not have a more appropriate method to this point.

0 Votes 0 · ·
Madhu-8808 avatar image Madhu-8808 RichardZhang-MSFT ·

@RichardZhang-MSFT We have to call a SDK in another 3rd party app we use. For that what we did was created a .NET C# class library project which is installed as plugin in that 3rd party app/software. Our plugin works as a socket server and listen to the UWP app clients connecting and then when the client sends a message we call that SDK method from this plugin. But later saw in some threads that there is a restriction in UWP when communicating via sockets to another app (even non uwp) in same machine. Our codes works fine with sockets in same machine when we tested with VS and even with the side loaded package. But from what I read it doesn't seem to be reliable. So I am looking for the best option to do this. So any guidance on this is really appreciated. https://stackoverflow.com/questions/60538388/uwp-to-another-app-communication-in-same-machine/60539035#60539035

0 Votes 0 · ·
Show more comments