예제 #1
0
        public static void Main(string[] args)
        {
            System.Console.Title = "DocaLabs.HybridPortBridge.ClientAgent.Console";

            var host = ClientForwarderHost.Build(args);

            host.Run();
        }
예제 #2
0
        private static void Main(string[] args)
        {
            var rc = HostFactory.Run(x =>
            {
                x.Service <ConsoleAgentHost>(sc =>
                {
                    sc.ConstructUsing(() => ClientForwarderHost.Build(args));
                    sc.WhenStarted(s => s.Start());
                    sc.WhenStopped(s => s.Stop());
                });

                x.SetDisplayName("DocaLabs.HybridPortBridge.ClientAgent.WindowsService");
                x.SetServiceName("DocaLabs.HybridPortBridge.ClientAgent.WindowsService");

                x.EnableServiceRecovery(r =>
                {
                    r.RestartService(TimeSpan.FromSeconds(5));
                });
            });

            var exitCode = (int)Convert.ChangeType(rc, rc.GetTypeCode());

            Environment.ExitCode = exitCode;
        }