Trying to deubg a windows service (removed the need to install, code, install, code, etc..), thought I found the solution
class Program
{
static void Main(string[]args)
{
ClientService service = new ClientService();
if (args.Length > 0)
{
Task.Factory.StartNew(service.Main, TaskCreationOptions.LongRunning);
Console.WriteLine("running...");
Console.ReadLine();
}
else
{
#if (!DEBUG)
ServiceBase[]ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new MyService()
};
ServiceBase.Run(ServicesToRun);
# else
ServiceBase.Run(service);
}
# endif
}
}
However I'm still getting the error:
Cannot start service from the command line or 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.
Any Ideas what I need to change to avoid the prompt?