I recommend following pattern for debug:
var ServiceToRun = new SomeService();
if (Environment.UserInteractive)
{
// This used to run the service as a console (development phase only)
ServiceToRun.Start();
Console.WriteLine("Press Enter to terminate ...");
Console.ReadLine();
ServiceToRun.DoStop();
}
else
{
ServiceBase.Run(ServiceToRun);
}
Edit: make sure that your target is Console Application, not Windows Application, otherwise it will not work.