Microsoft Windows Service (2) use Topshelf to create a Windows Service, microsofttopshelf
In addition to the windows Service templates provided by. net, Topshelf is another method for creating Windows Services.
Official website tutorial: http://docs.topshelf-project.com/en/latest/configuration/quickstart.html
Advantages:
1. You can directly debug and run it.
2. More convenient commands.
3. Topshelf is an open-source cross-platform host service framework that supports Windows and Mono
Download:
Install-Package Topshelf
Development:
0. Create a Service 1. Install 2. Start 3. Stop 4. Uninstall 5. debug the service 6. Monitor the service
Create a service:
1. It is very easy to create a service using Topshelf. Build any class and provide a start and stop method.
2. This section uses System. Timers. Timer for scheduled task processing.
Installation:
A. cd locate the program directory. B. The program runs c. program name install as Administrator
Start:
Start program name
Stop:
Stop program name
Uninstall:
Uninstall program name
Debugging service:
Run directly to debug
Monitoring:
Use ServiceController to obtain the service status or control the service.
This class can obtain the service status, attributes, and services.Start and StopOperation
Download Code:Click to download