예제 #1
0
        /// <summary>
        /// The entry point of the program, where the program control starts and ends.
        /// </summary>
        /// <param name="args">The command-line arguments.</param>
        public static async Task Main(string[] args)
        {
            var logger = new ManagerLogger();

            using (var host = PrepareHost(args))
            {
                try
                {
                    await host.RunAsync();
                }
                catch (IOException e)
                {
                    logger.Error(e.Message, e);

                    logger.Info("Stopping main application.");
                    await host.StopAsync(TimeSpan.FromSeconds(5));
                }
                catch (Exception e)
                {
                    logger.Error(e.Message, e);
                }
            }

            logger.Info("Application stopped.");
        }