Create windows services in UWP

Hennry 21 Reputation points
2020-02-27T06:55:11.617+00:00

I know how to creat windows services in Net, but how to do it using UWP, I want the service can run it automatically and we can stop it if we want.
Thanks.

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. James Dailey - MSFT 336 Reputation points Microsoft Employee
    2020-02-27T23:43:08.703+00:00

    You cannot create a traditional Windows Service using the UWP platform. However, you can create a an App Service that uses a Background Task. You can communicate between an app and your UWP App Service using a defined API surface much like a web service. I've included links below with more information.

    Create and consume an app service
    https://learn.microsoft.com/en-us/windows/uwp/launch-resume/how-to-create-and-consume-an-app-service

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. FernandoJunioCunhaeSousa-0285 1 Reputation point
    2022-10-14T13:48:25.497+00:00

    Sorry for digging up this topic. But I need to sharing this information. :)

    We needed to create a windows service "using" uwp application for publishing at MS store, and it was possible using a desktop bridge package.

    Now it's possbile using the simplest way put it on at app manifest. But it needs some restricted capability.

    You can see how it work here: https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-desktop6-service

    0 comments No comments