Using. Net to develop Windows Services is particularly simple. vs2005 has integrated Windows service project templates.
All Windows Services are encapsulated inSystem. serviceprocessProgramCentralized.
Main categories:
1. servicebase: The base class of all Windows Services. Generally, the service we create must inherit from it. The most important class. Its EventLog attribute can write logs to the system. The corresponding eventsource will be created during installation
2. serviceinstaller: Service Installation class, which controls some settings during service installation, such as name, description, starttype, servicedependedon...
3. serviceprocessinstaller: used to set the service process account during installation.
For the classes 2nd and 3, right-click the service class> add installer in vs to automatically generate the class. You only need to modify the relevant attributes.
After creating a service project, you can create an installation service project to automatically install the service to the target machine.
You can also install the SDK manually. The SDK command is installutil <services. dll>. Please include a parameter/u during reverse installation.
An example program is provided for your reference.
Demowindowsservice.zip