How UWP can communicate with Windows Service

baget 221 Reputation points


I have Windows Service (C++ win32) and UI application (C#), today they communicate via COM Object.
I would like to convert the UI to UWP, what are my options for IPC Between the Service and the UWP app?
I still need the Service to stay Win32 Windows Service.

Universal Windows Platform (UWP)
0 comments No comments
{count} vote

2 additional answers

Sort by: Most helpful
  1. Roy Li - MSFT 32,721 Reputation points Microsoft Vendor


    Welcome to our Microsoft Q&A platform!

    UWP could not communicate with Windows Service directly. In order to implement the IPC between windows service and UWP apps, a possible way is to create a win32 app that could communicate with the Windows Service, and then the UWP app could communicate with the win32 app using App Service.

    With the capability-runFullTrust, UWP apps could launch the win32.exe file. It is a restricted capability which means you must provide info during the app submission process in order to be approved to publish the app to the Microsoft Store. Sideload apps don't need to receive any approval to use the restricted capability. For more information about restricted capabilities, please refer to Restricted capabilities.

    Here is a sample about how UWP apps could launch the win32 exe file and communicate with it using App Service: AppService Bridge Sample

    Please note if you want to use App Service APIs in win32 apps, you will need to add some references first. For more information, please refer to Call UWP APIs in desktop apps.

    1 person found this answer helpful.

  2. Ivanich 306 Reputation points

    In theory, you can try reinvent a bicycle and use Windows objects for communication. For example, named mutex and named memory mapped file should be enought to build interprocess communication.