Windows service creation, debugging design, installation

Source: Internet
Author: User

You may often encounter such a situation: the server suddenly breakpoints, the background of the program can not be automatically started as a service before the user logon , the following we use the Server background service automatic monitoring service as a portal for analysis.

Learning Reference:

Http://www.cnblogs.com/sorex/archive/2012/05/16/2502001.html

Http://jingyan.baidu.com/article/fa4125acb71a8628ac709226.html

Design environment: Visual Stdio C #. NET4.5

================================

Reference steps:


Add the system.serviceprocess the reference.

The pits encountered:

How to encode the executable file in ASNI encoded mode

Unable to uninstall some services: SC Delete Service name


Method Reference:

The first method:

1. Start and run->cmd
2. CD to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 (the Framework version number is configured by IIS)
3. Installation Service: Run command line InstallUtil.exe E:/test.exe
Uninstall Service: Run command line installutil.exe-u E:/test.exe

This can be deleted, but if it can not be deleted, there is a way below.

The second method:

Run-->cmd--> to C:\Windows\System32 folder and enter SC Delete < service name, and then you can uninstall the service

At this time, we can use another command to uninstall, as follows:

C:\WINDOWS\SYSTEM32>SC Delete MyService

The MyService is the name of your service, such as the following services, its uninstall command can be written as follows:

SC Delete "service name"

Of course you can also use this tool to create,start,stop the service. For example, we can install the service with the following command, and start the service up.

InstallUtil HongjunGuo.JobsWindowsService.exe
SC start "service name"


Windows service creation, debugging design, 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.