C# – How to start the windows service

cc#-4.0windows-services

I am trying to start my Windows services application but i am getting the following error

Cannot start service from the command line or a debugger.
A Windows Service must first be installed (using installutil.exe)
and then started with the ServerExplorer, Windows Services
Administrative tool or the NET START command.

Could someone please help me on this..

Best Answer

As they say in the comments - you can't start a windows service unless you install it and run it from the Service Manager (Services)

A solution: I would recommend to add a console main entry point in your C# service program so you can actually start it from both the Service Manager and debugger / exe execution.

http://einaregilsson.com/run-windows-service-as-a-console-program/