Using Topshelf to manage Windows services

Source: Internet
Author: User

First, the official website and source code download1, the official website: http://topshelf-project.com/2, source download: https://github.com/Topshelf/Topshelf/downloads Second, topshelf Advantage1. CommissioningConvenient: You can create a console program without creating a Windows Service project, and start the console to debug your service code2. Install/Uninstall Service method
1, CMD-->CD program directory (directly to the directory where EXE files) 2, Installation Services: JwifiRoute.Message.LogServices.exe Install
3. Start the service:JwifiRoute.Message.LogServices.exe Start4.Uninstall service (need to perform multiple times to uninstall Service): JwifiRoute.Message.LogServices.exe Uninstall Iii. Creating a service using topshelf 1. IntroductionTopshelf.dll 2, start the service
        /// <summary>        ///The main entry point for the application. /// </summary>        Static voidMain () {Hostfactory.run (c={c.setservicename ("logservices"); C.setdisplayname ("logservices"); C.setdescription ("logservices"); C.service<TopshelfService> (s ={s.constructusing (b=NewTopshelfservice ()); S.whenstarted (o=O.start ()); s.whenstopped (o=o.stop ());            }); });

3. Service Program Logic
 Public class Topshelfservice      {        publicvoid  Start ()        {            // service logic          publicvoid  Stop ()        {        }}

Using Topshelf to manage Windows services

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.