How do I deploy Windows services?

Source: Internet
Author: User

1. Create the installer for the service
1), return to the "design" view of Service1.
2), click the background of the designer to select the service itself, not any of its contents.
3), in the Properties window, click the Add Installer link in the gray area below the list of properties.
By default, a component class that contains two installers is added to your project. Name the component ProjectInstaller, which contains the Setup program for the service and the installer for the service-associated process, respectively.
4), access the Design view of the ProjectInstaller, and then click ServiceInstaller1.
Note: The account property of ServiceProcessInstaller1 is set to LocalSystem, otherwise the installation cannot be
5), in the Properties window, set the ServiceName property to MyNewService.
Note: DisplayName is set to a name that is displayed in the Administration Tools service and is set to empty in the Administrative Tools service without displaying
6), set the StartType property to Automatic.

2. Build Service Project
1), in Solution Explorer, right-click your project and choose Properties from the shortcut menu. The Property Pages dialog box for the project appears.
2), in the left pane, select the General tab in the Common Properties folder.
3), in the Startup object list, select MyNewService.
4), press Ctrl+shift+b to build the project.
Once the project is built, it can be deployed. The Setup project installs the compiled project files and runs the Setup program that is required to run the Windows service. To create a complete Setup project, you need to add the project output MyNewService.exe to the Setup project, and then add a custom action to complete the MyNewService.exe installation.

3. Create a setup project for the service
1), on the File menu, point to Add Project, and then select New Project.
2), select the Setup and Deployment Projects folder in the Project Types pane.
3), select Setup Project in the Templates pane. Name the project MyServiceSetup.

4. Add MyNewService.exe to the installation project
1), in Solution Explorer, right-click MyServiceSetup, point to Add, and then select Project Output.
The Add Project Output Group dialog box appears.
2), select "MyNewService" in the "Project" box.
3), in the list box, select Primary Output, and then click OK.

5. Add a custom action to the installation project
1), in Solution Explorer, right-click the Setup project, point to view, and then select Custom Action.
The Custom Actions Editor appears.
2), in the Custom Actions Editor, right-click the Custom Actions node and select Add Custom action.
The Select Items in Project dialog box appears.
3), double-click Application Folder in the list box to open it, select Primary output from MyNewService (active), and then click OK.
The primary output is added to all four nodes of the custom operation-installation, Commit, rollback, and uninstall.
4), build the installation project.

6. Install Windows Services
Browse to the directory where you saved the installation project and run the. msi file to install MyNewService.exe.

7. Start and stop services
Open the Service Control Manager by doing one of the following:
1), in Windows Professional, right-click My Computer on the desktop, and then click Manage. In the Computer Management console, expand the Services and Applications node. or in Windows Server, click Start, point to Programs, click Administrative Tools, and then click Services.
Note In Windows NT version 4.0, you can open the dialog box from Control Panel.
You should now see MyNewService listed in the Services area of the window.
2), select your service from the list, right-click the service, and then click Start.
3), right-click the service, and then click Stop.

8. Verify the event log output of the service
1), open Server Explorer and access the event log node. For more information, see Handling event Logs in Server Explorer.
2), locate the list of MyNewLog and expand it. You should see an entry for the action performed by the service.

9. Uninstall Service
1), on the Start menu, open Control Panel and click Add/Remove Programs, and then locate your service and click Uninstall.
2), you can uninstall the program by right-clicking the program icon in the. msi file and selecting Uninstall.

How do I deploy Windows services?

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.