Windows Service Application Overview

Source: Internet
Author: User
[Windows Service overview]
Differences between services and applications
You need to attach it to the process for debugging.
You need to create and install
Use event log records for error messages
Use your own User Permissions
..................

Service Lifecycle
Install
Start, Run, pause, and stop

Service Type
Single type (win32ownprocess)
Sharing type (win321_process)

[Create a Windows Service]
Create a "Windows Service" Project

Set the "servicename" attribute
This attribute must match the one in the installation class.

Set the following attributes
Canstop
Can the service be stopped?
Canshutdown
Whether the Service accepts the shutdown message and triggers the onshutdown event
Canpauseandcontinue
Whether the service can be stopped and run
Canhandlepowerevent
Whether the service can control power events
Autolog
Whether the service automatically records information to the applicationProgramEvent Log

CustomCode
Reload onstart, onstop, and other methods

Add an installer for the service and compile the project

Install the created and compiled Windows Service

[Add installer for Windows Service]
Add installer
Right-click a Windows Service and choose add installer.

Set serviceinstaller attributes
The servicename attribute matches the name set in the Windows service.
Set the start type: manual, automatic, and disabled.

Set serviceprocessinstaller attributes
Set security context for services

Reload related methods

To add other services, repeat the preceding steps.
Actually, "serviceinstaller" is added"
All services share one "serviceprocessinstaller"

[Deploy and uninstall Windows Services]
Command Line
Deployment: installutil myproject.exe
Uninstall: installutil/u myproject.exe

Installutil tool Directory: C: \ WINDOWS \ Microsoft. NET \ framework \ v2.0.50727

Installation Method
Right-click the solution and choose new project.
Setup and deployment projects
Setup Project
Right-click the new project, project output, primary output, and OK

Msdn
Windows service applications

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.