// The main entry point for the process static void Main() { #if (!DEBUG) System.ServiceProcess.ServiceBase[] ServicesToRun; ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service1() }; System.ServiceProcess.ServiceBase.Run(ServicesToRun); #else // debug code: allows the process to run as a non-service // will kick off the service start point, but never kill it // shut down the debugger to exit Service1 service = new Service1(); service.OnStart(null); System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite); #endif }