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