Setting Up Surface Service Applications

A Microsoft Surface service application runs in the background and interacts with Surface Shell, and it does not have a user interface. A service application can initiate user notifications (for example, about printing that is complete or network messages received). A user notification can also give the option of starting a different application. You might also want to use service applications for continuous operations or system monitoring.

Because service applications persist across Surface Shell sessions (user sessions), make sure that previous user information is not exposed to subsequent users.

Registering Service Applications

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

Starting Service Applications

Surface starts service applications differently than other applications.

When a device made for Surface enters Surface mode, all registered service applications are started. When 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 Surface platform suppresses any visible windows that the application creates and Surface might enter the out-of-order state. For more information about UI suppression in Surface mode, see Windows Mode and Surface Mode.

Monitoring Service Applications

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

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

The 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.

Did you find this information useful? Please send us your suggestions and comments.

© 2011 Microsoft Corporation. All rights reserved.