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