Пример #1
0
        private static void RunAsService(string[] args)
        {
            var win32Service = new Win32Service(args.Where(a => a != RunAsServiceFlag).ToArray());
            var serviceHost  = new Win32ServiceHost(win32Service);

            serviceHost.Run();
        }
Пример #2
0
        private static void RunInteractive(string[] args)
        {
            var win32Service = new Win32Service(args.Where(a => a != InteractiveFlag).ToArray());

            win32Service.Start(new string[0], () => { });
            Console.WriteLine(win32Service.ServiceName);
            Console.WriteLine("Running interactively, press enter to stop.");
            Console.ReadLine();
            win32Service.Stop();
        }