public static async Task Main(string[] args)
        {
            var configuration = GetConfiguration(args);

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

            try
            {
                DockerHelpers.ApplyDockerConfiguration(configuration);

                var host = CreateHostBuilder(args).Build();

                await ApplyDbMigrationsWithDataSeedAsync(args, configuration, host);

                host.Run();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Host terminated unexpectedly");
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            var configuration = GetConfiguration(args);

            Log.Logger = new LoggerConfiguration()
                         .ReadFrom.Configuration(configuration)
                         .CreateLogger();
            Log.Information("Start Host");
            try
            {
                DockerHelpers.ApplyDockerConfiguration(configuration);
                var isService = !(Debugger.IsAttached || args.Contains("--console"));
                if (isService)
                {
                    Log.Information("Start WS1");
                    var host = CreateHostBuilder(args).UseWindowsService().Build();
                    //await ApplyDbMigrationsWithDataSeedAsync(args, configuration, host);
                    Log.Information("Start WS2");
                    host.Run();
                    Log.Information("Start WS3");
                }
                else
                {
                    Log.Information("Start Web");
                    var host = CreateHostBuilder(args).Build();

                    //await ApplyDbMigrationsWithDataSeedAsync(args, configuration, host);

                    host.Run();
                }
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Host terminated unexpectedly");
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            var configuration = GetConfiguration(args);

            Log.Logger = new LoggerConfiguration()
                         .ReadFrom.Configuration(configuration)
                         .CreateLogger();
            try
            {
                DockerHelpers.ApplyDockerConfiguration(configuration);

                CreateHostBuilder(args).Build().Run();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Host terminated unexpectedly");
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
Ejemplo n.º 4
0
        public static async Task Main(string[] args)
        {
            var configuration = GetConfiguration(args);

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

            try
            {
                DockerHelpers.ApplyDockerConfiguration(configuration);

                var host = CreateHostBuilder(args).Build();

                var migrationComplete = await ApplyDbMigrationsWithDataSeedAsync(args, configuration, host);

                if (args.Any(x => x == MigrateOnlyArgs))
                {
                    await host.StopAsync();

                    if (!migrationComplete)
                    {
                        Environment.ExitCode = -1;
                    }

                    return;
                }
                await host.RunAsync();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Host terminated unexpectedly");
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }