UWP App Communication with Windows Service

后端 未结 2 1113
北海茫月
北海茫月 2020-12-30 12:04

We are fixing to re-architect an application and are debating whether or not it is possible to use UWP instead of an ordinary WPF application.

Our application needs

相关标签:
2条回答
  • 2020-12-30 12:14

    You can check my sample code: https://github.com/manupstairs/UWPWithWCFSample

    I think WCF is the right answer.

    For duplex binding, check this one: https://github.com/manupstairs/UWPwithDuplexWCF

    One step closer to submit one APPX to MS Store. You need desktopbridge tech. UWP UI part and WCF service host in console. We can combine them into one APPX.

    Capability "runFullTrust" is necessary. https://developer.microsoft.com/en-us/windows/bridges/desktop/

    0 讨论(0)
  • 2020-12-30 12:16

    Do you think our approach is feasible?

    We cannot directly consume a Windows Service in an UWP app. In order to make the IPC between Win32 app and UWP app, what may help here is using the new Capability <rescap:Capability Name="runFullTrust" />, and it enable the Win32 app which is launched by the FullTrustProcessLauncher API to achieve the uplevel app security context to consume WinRT APIs. But as you see the rescap here, it means this UWP app cannot be published in Store.

    You can refer to the official AppService Bridge Sample. You can try to firstly create a traditional desktop app which consume App service (which can communicate with WPF and UWP app, not traditional Windows service) and use WinRT APIs, after building this app (don't run it), a .exe file will be generated. But this app cannot run since it uses WinRT API, then you can create your UWP app to make this desktop app executable.

    we've looked into things like SignalR and the Desktop Bridge but are unsure which may be the best approach for our scenario.

    So I think the Desktop Bridge may be the best approach here.

    0 讨论(0)
提交回复
热议问题