I just built a very simple Windows service to test something and built it to get the .exe. As per this article in MSDN, I also installed the service using the Visual Studio Command Prompt 2010 (ran as administrator) installutil TestService.exe.
When using the installutil command, everything runs fine and I get a message saying that the service has been installed. Further, to start the service when I check inside the Services node (in Server Explorer in Visual Studio), I do not see any service named TestService.exe.
Also, Start Menu -> My Computer (Right Click) -> Manage -> Services and Application -> Services does not show the TestService.exe through which I could start the service.
Any suggestions how do I start the service?
Code inside OnStart function:
Process[] testProcess = Process.GetProcessesByName("notepad.exe");
if (testProcess.Length == 0)
File.WriteAllText(@"C:\Users\User1\Desktop\service.txt", "nothing");
else
File.WriteAllText(@"C:\Users\User1\Desktop\service.txt", "run");
I have had problems with
installutilbefore and found using thesccommand works whereasinstallutildidn’t.Try installing your service with this command: