public static void Main(string[] args) { // checks if we are running as a service or as a console interactive application // this allows us to run the same code interactively (for debug prupourses) or // in production if (!Environment.UserInteractive) { ServiceBase[] servicesToRun; servicesToRun = new ServiceBase[] { new DVRBService() }; ServiceBase.Run(servicesToRun); } else { DVRBService service = new DVRBService(); service.DVRBStart(null); System.Console.WriteLine("Press Enter to stop the service"); System.Console.ReadLine(); service.DVRBStop(); } }