예제 #1
0
        public static async Task Main()
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            var configuration = new ConfigurationBuilder()
                                .SetBasePath(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location))
                                .AddJsonFile("appsettings_LogServer.json").Build();

            Log.Logger = new LoggerConfiguration().ReadFrom.Configuration(configuration).CreateLogger();

            try
            {
                Log.Information("Starting Analogy Log Server");
                await CreateHostBuilder().Build().RunAsync();

                await GrpcEnvironment.ShutdownChannelsAsync();

                await GrpcEnvironment.KillServersAsync();
            }
            catch (Exception e)
            {
                Log.Fatal(e, "Error during application");
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
 public override Task StopReceiving()
 {
     gRPCReporter.Instance.OnMessageReady -= OnInstanceMessageReady;
     _cts.Cancel();
     Disconnected(this, new AnalogyDataSourceDisconnectedArgs("user disconnected", Environment.MachineName, Id));
     _cts = new CancellationTokenSource();
     _hoster?.Dispose();
     return(GrpcEnvironment.KillServersAsync());
 }