Issues encountered with Windows service development

Source: Internet
Author: User
Tags visual studio 2010

1. Installation of Windows Services

To install the Windows service through the cmd Run command:

Installation method: Run cmd to InstallUtil.exe to run the Windows service program.

If it is release mode, paste the command directly in the cmd window C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe "D:\Project files\ Mailsendauto\mailsendauto\bin\release\mailsendauto.exe "
If it is debug mode, paste the command directly in the cmd window: \windows\microsoft.net\framework\v4.0.30319\installutil.exe "D:\Project files\ Mailsendauto\mailsendauto\bin\debug\mailsendauto.exe "

where "v4.0.30319" depends on the version of the Windows Service assembly, plus v3.5, v3.0, v2.0.50727, and more

List of issues (Win8 + Visual Studio 2010):

Error 1: Unable to open "." On the computer. Server controller, this operation may require additional privileges .... The error message is as follows: Access denied ... Performing rollback ... Installation failed with rollback performed

Solution: Obviously it should be related to system authority and so on. Do not run cmd directly win+r, should run C:\Windows\System32\cmd.exe as Administrator and execute installation instructions

Error 2: Failed to load file or assembly or one of his dependencies. The system cannot find the file specified.

Solution: A low-level error, a consequence of carelessness. The Windows service path D:\...\mailsendauto.exe is not enclosed in double quotes in the instructions that CMD executes.

2. Uninstall Windows service

Run C:\Windows\System32\cmd.exe as Administrator, execute instruction: SC delete winservicetest (Windows service name).

3, debugging Windows services.

Start Visual Studio 2010 as an administrator, open the Windows service, install the Windows service, and start after compiling successfully in debug mode.

Then click on toolbars to attach to the process, you can find the corresponding Windows service name in the list of available processes, select and attach. And then you can debug the breakpoint.

Issues encountered with Windows service development

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.