/// <summary> /// The main entry point for the application. /// </summary> static void Main() { var service = new Service1(); if (!Environment.UserInteractive) { var servicesToRun = new ServiceBase[] { service }; ServiceBase.Run(servicesToRun); return; } service.Start(); Console.ReadLine(); }