I. Introduction to Windows Services
Windows services are programs that can be opened automatically when the system starts (no one is required to log on to the computer).
1. A scenario for creating a Windows service:
[1] In the absence of user interaction operation in the case of running the program;
[2] Run the program under a user with greater privileges than the interactive user;
2. Examples of Windows services:
[1] WCF host (assuming that IIS is not available for some reason);
[2] A program that caches data from a network server;
[3] A program that organizes local disk data in the background.
3. Management of Windows Services:
Under Windows system: Control Panel → system and security → management tools → services, or search for "services" directly in search Web and Windows.
Second, the architecture of Windows services
There are three types of programs required to operate WINDOWS Services: Service programs, service control procedures, and service configurator.
1, Service procedures: to provide the actual functions required;
A service program requires three parts: the main function, the Service-main function, and the handler.
The Service Control Manager (MANAGER,SCM), which is very important to the service, can send a request to the service to start the service or stop the service. SCM is an integral part of the operating system, and its role is to communicate with the service.
[1] Main function
2. Service Control program: used to send control request to service, such as Start, stop, pause and continue.
3, service Configuration program: for the installation of services, which means not only to copy the service to the file system, but also to write the service information into the registry, the registration information is used by the Service Control Manager (SCM) to start and start the service.
[1]
A detailed description of Windows Service