2.Windows Service-On-load service

Source: Internet
Author: User

1. Use the VS component "VS2012 Developer Command Prompt" tool to perform an on-load service (must be run as "Administrator")

When installing and uninstalling, select the appropriate installer tool address, for example:

Installation Services: C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe service Path

Uninstall Service: c:\windows\microsoft.net\framework\v4.0.30319\installutil.exe/u service path

For example:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe F:\ code example \demo\testservice\bin\debug\ TestService.exe

c:\windows\microsoft.net\framework\v4.0.30319\installutil.exe/u F:\ code example \demo\testservice\bin\debug\ TestService.exe

View and start the service

  

Open the 1.txt file under F disk to check if the service is working properly

  

2. Use batch file to carry out the loading and unloading service

Install.bat File Contents

@echo Installation Services
%systemroot%\microsoft.net\framework\v4.0.30319\installutil TestService.exe

@echo Start the service
net start Testservice

Uninstall.bat File Contents

@echo Uninstall Service
%systemroot%\microsoft.net\framework\v4.0.30319\installutil testservice.exe/u

Note:

1. Install.bat and Uninstall.bat files and service programs are placed in the same directory.

2. If there are multiple services in the solution, file names are suggested to change to this style: Testserviceinstall.bat and Testserviceuninstall.bat

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.