Exemplo n.º 1
0
        public static void Run(string[] args)
        {
            if (IsConsoleHost(args))
            {
                var container = new BackendServiceHostContainer(typeof(T));
                container.StartService();
                Console.WriteLine("Hosting the following services:");
                var name = container.GetHostedServiceDescription();
                Console.WriteLine("Service: " + name);
                Console.WriteLine("Press <Enter> to close.");
                Console.ReadLine();

                container.StopService();
            }
            else
            {
                var servicesToRun = new ServiceBase[] { new WindowsServiceHost(typeof(T)) };
                ServiceBase.Run(servicesToRun);
            }
        }
Exemplo n.º 2
0
 protected override void OnStart(string[] args)
 {
     container.StartService();
 }