Microsoft Surface Service Applications

Surface 1.0 SP1

The Microsoft Surface platform enables you to develop service applications that can run in the background and interact with the Surface Shell component. A service application does not provide a user interface.

For example, a service application can initiate user notifications (for example, about printing that is complete or network messages that are received). A user notification can also give a user the option of starting a different application. You might also want to use service applications for continuous media operations or system monitoring.

securitySecurity Note
Because service applications persist across Surface Shell sessions (user sessions), you must ensure that previous user information is not exposed to subsequent users.

Registering Service Applications

Each service application is registered in its own XML file in the %ProgramData%\Microsoft\Surface\Programs folder, just like other Microsoft Surface applications. A service application's registration XML file contains a <ServiceApplication> element instead of an <Application> or <AttractApplication> element. For more information about the registration XML file for Microsoft Surface applications, see Registering a Microsoft Surface Application.

Starting Service Applications

Microsoft Surface starts service applications differently than other applications.

When a Microsoft Surface unit enters user mode, Microsoft Surface starts all registered service applications. When Microsoft Surface starts a service application, it runs the process without a console window so that the UI suppression functionality does not stop the service application. If a service application tries to run a GUI window, the Microsoft Surface platform stops the application.

Service applications can display a GUI in administrator mode for testing and debugging purposes.

Service applications persist across user sessions. If a service application has user information, such as name or hotel room number, that information might be revealed to other users. A service application can subscribe to the SessionEnded event to know when to clean up any personal data before the next user starts an experience.

Monitoring Service Applications

The Microsoft Surface platform monitors service applications for failures (crashes) and restarts service applications if they crash or exit with a non-zero exit code. By default, the platform waits 10 seconds before it restarts a service application. You can change this delay through the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Surface\v1.0\Shell\ServiceApplicationRestartDelay registry value.

There is no limit on the number of times that the Microsoft Surface platform restarts a service application.

The Microsoft Surface platform does not restart services if they exit normally (with an exit code of zero), and it does not monitor if service applications stop responding (hang).

Community Additions