Windows Service Learning Notes

Source: Internet
Author: User

1. Application Scenarios

Windows service programs are executable programs that can perform specific functions under the Windows operating system. It is suitable for use with long running functions.

2. Create a Windows service

After the creation is complete, see the following:

Change the name of the Service1 to the name you want, such as "HelloService"

3. Create the Service Setup program

Modify the installation service name

Modify Installation Permissions

4. Write the program

Once you have completed the above steps, you can start our program.

The main use of the two methods are OnStart and OnStop. Override these two methods to log the time that the service was started and the service ended.

5. Installation

After everything above is done, you need to install the service you just created on the server.
Use the InstallUtil.exe program inside the. Net Framework to install.
In the Command window, open the folder where InstallUtil.exe is located. Direct Input Command
. \installutil Path to Windows services
This allows you to create a.

After the installation is complete, the "Services" window can be seen as a slice:

After you install the Windows service, it does not start itself and requires you to right-click and select "Start" to launch it.


Tested, in the log file, you can see the log records just completed.

Windows Service Learning Notes

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.