Windows Service creation process

Source: Internet
Author: User
Create a project-Visual C # project-Windows service.

2. After modifying the corresponding class name, drag and drop the corresponding components on the class design page. 3. You can perform corresponding operations on OnStart and OnStop, such as writing a service running Log to DB. 4. Handle the event of the drag-and-drop component accordingly. (The eventLog component is usually used to record the running logs of events. In this case, you need to specify the Log and Source attributes. Log is divided into three types: application, security, and system, specifies the service program to which Source logs are written.) 5. use the install class to switch to the project design page. Click the "add installer" option in the lower right of the Properties window,.. Net automatically adds a project installer. cs file. The design screen of this file contains two controls: serviceProcessInstaller1 and serviceInstaller1. 6. Set the Account (Account type) of serviceProcessInstaller1. Select LocalSystem to run the local system Account or select User. In this case, you can specify the User name and password. 7. You can specify the StartType attribute of serviceInstaller1, indicating whether the service runs automatically or manually. 8. compile the project and find the executable file suffixed with .exe in the bin/debugdirectory. 9. open start-program -- Microsoft Visual Studio. NET 2003 -- Visual Studio. NET tool -- Visual Studio. NET 2003 command prompt 10. enter the bin/debug directory of the current project in the command prompt. 11. Enter Installutil Executable File name after compilationThe service is successfully installed. 12. Then you can view the created Service in Control Panel-management tools-service. 13. Enter Installutil/u Executable File name after compilation, Will uninstall the service. 14. Each modification to the original program requires uninstallation, recompilation, and re-installation.

 

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.