Windows Service Installation

Source: Internet
Author: User

There are two ways of doing this:

1. In VS2010 and the following versions

    • First open the service main program file in Design view, right-click to select "Add Installer"

    • Set the appropriate properties after adding ProjectInstaller

The general settings are as follows:

To set the properties of the ServiceInstaller1 component:
1) ServiceName = Service Name
2) StartType = Automatic, i.e. automatic
Setting the properties of a serviceProcessInstaller1 component
1) account = LocalSystem, accounts are generally set to local system

    • On the solution, right-select Add-New project, adding a Setup project

    • Set up the project

Finally compile the solution, in the Setup Project Project Debug directory can find the service installation program, directly click Install.

2. In VS2012 and later

    • Also need to add installer, the process ibid.
    • Add a text file to the project, rename it to Install.bat, and edit the contents of the file as follows:

      @echo off
      C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe-i "WindowsService1.exe"
      @pause

    • Add a text file to the project, rename it to Uninstall.bat, and edit the contents of the file as follows

      @echo off
      C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe-u "WindowsService1.exe"
      @pause

    • After compiling, copy the debug files to the directory you want to install, click Install.bat to complete the installation (server 2008 and above servers need to run in administration mode)

You may be prompted to not find WindowsService1.exe when you run Install.bat, you need to specify the absolute path of WindowService1.exe in Install.bat

Windows Service Installation

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.