Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In UWP, you could host an app service in the same process as your app by overriding OnBackgroundActivated on your Application class. Windows App SDK doesn't support this pattern.
Why in-process app services aren't available
Microsoft.UI.Xaml.Application doesn't define an OnBackgroundActivated override, and ExtendedActivationKind — the enum Windows App SDK apps use to inspect how they were activated — has no AppService member. Because of this, there's no supported way for a Windows App SDK app's own process to receive app-service activation. App services on Windows App SDK must always run as an out-of-process background task.
What to use instead
- To provide an app service, implement it out-of-process. Create a separate Windows Runtime Component project that implements
IBackgroundTask, and reference it as theEntryPointin your manifest'sappServiceextension. This pattern works for both UWP and Windows App SDK provider apps. For steps, see Create and consume an app service. - If you only need to share data or call functionality within the same app, you don't need an app service or
AppServiceConnectionat all. Since the code runs in the same process, call the shared class or method directly instead of routing the call through inter-process communication.
Related content
Windows developer