Windows service

From Wikipedia, the free encyclopedia

Jump to: navigation, search

On Microsoft Windows operating systems, a Windows service is a long-running executable that performs specific functions and which is designed not to require user intervention. Windows services can be configured to start when the operating system is booted and run in the background as long as Windows is running, or they can be started manually when required. They are similar in concept to a Unix daemon. Many appear in the processes list in the Windows Task Manager, most often with a username of SYSTEM, LOCAL SERVICE or NETWORK SERVICE, though not all processes with the SYSTEM username are services. The remaining services run through svchost.exe as DLLs loaded into memory.

Contents

[edit] Managing services

Once a service is installed, it can be managed by launching "Services" from the Windows Control PanelAdministrative Tools or typing "Services.msc" in the Run command on Start menu. The "Services" management console provides a brief description of the service functions and displays the path to the service executable, its current status, startup type, dependencies and the account under which the service is running. It enables users to:

  • Start, stop, pause or restart services.
  • Specify service parameters.
  • Change the startup type which includes Automatic, Manual and Disabled:
    • Automatic starts the services at system logon,
    • Manual starts a service as required or when called from an application (according to definition, but only some of the time in practice, depending on the service),
    • Disabled completely disables the service and prevents it and its dependencies from running.
    • Automatic (Delayed) is a new startup type introduced in Windows Vista, that starts the service a short while after the system has finished booting and initial busy operations, so that the system boots up faster.
  • Change the account under which the service logs on.
  • Configure recovery options upon service failure.
  • Export the list of services as a text file or a CSV file.

In Windows XP Service Pack 3 and Windows Vista, besides the Services management console, users can manipulate services using MSConfig. The use of MSConfig to manage services, however, causes a prompt on the next startup. MSConfig can hide all operating system services for troubleshooting. Under Windows Vista, a Services tab in Windows Task Manager can be used to start or terminate a service or go to its process on the Processes tab. Users can also use the SC command in the command prompt.

[edit] Developing a Windows service

A Windows Service is created using development tools such as CodeGear Delphi and Microsoft Visual Studio. Windows provides an interface called the Service Control Manager that manages the starting and stopping of services. An application that wants to be a service needs to first be written in such a way that it can handle start, stop, and pause messages from the Service Control Manager. Then, in one or more API calls, the name of the service and other attributes such as its description are registered with the Service Control Manager. Although typically services do not have a user interface, developers can add forms and other UI components. In this case, the "Allow service to interact with desktop" should be checked on the Logon tab in the Service properties dialog.

[edit] See also

[edit] External links

Personal tools