Windows Service Creation

Source: Internet
Author: User

Some time ago to go out to interview, technical too many kinds of crazy abuse, and asked about the Windows services related things, and now sleep, up just a rough study of a, words do not say much.

Solution:

1. Open vs, new project-windows service


Open Services1.cs when creation is complete


2. Right-click the interface and add the installer


At this point, you will find several more files


To modify an account during installation


You can also modify the service name and service startup mode


3. Compile after modification, open the compiled EXE file


After compiling, you need InstallUtil.exe to install the service, open the framework default installation location, find this executable file


4. Open the cmd command prompt and go to the InstallUtil.exe directory, followed by the full path of the service after executing the installation service file


5. When the installation is complete, you can open the service and you can see that the MyService installation is successful.


Start the service and open Task Manager to see the service you just installed.


Appendix: After you create a new Windows service, install the service without adding the installer, you will get an error


The above can create a simple Windows service, you can get a bat file yourself to execute.

Install service command:

C \ Path \installutil.exe "service path \ Service. exe"

Uninstall Service Command:

C \ Path \installutil.exe/u "service path \ Service. exe"

Windows Service Creation

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.