Exemplo n.º 1
0
        static void Main(string[] args)
        {
            LogConfigurator.Configure();
            _log = Log.Logger.ForContext <TCPHostServer>();

            using (var service = new TCPHostServer())
            {
                if (!Environment.UserInteractive && !args.Contains("--docker"))
                {
                    // running as service
                    ServiceBase.Run(service);
                }

                else
                {
                    // running as console app
                    ListenToKeyboard();
                    string envVariableValue = Environment.GetEnvironmentVariable(EnvironmentVariables.LocalIp);
                    string localIp          = !string.IsNullOrWhiteSpace(envVariableValue)
                        ? envVariableValue
                        : ExtractIpFromArgs(args);
                    service.Run(localIp, true);
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            using (var service = new TCPHostServer())
            {
                if (!Environment.UserInteractive)
                {
                    // running as service
                    ServiceBase.Run(service);
                }

                else
                {
                    // running as console app
                    ListenToKeyboard();
                    service.Run();
                }
            }
        }