Microsoft Windows Service (2) use Topshelf to create a Windows Service, microsofttopshelf

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.