Beispiel #1
0
        public static void Main(string[] args)
        {
            var logger = NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();

            try
            {
                var host = CreateWebHostBuilder(args).Build();
                using (var scope = host.Services.GetRequiredService <IServiceScopeFactory>().CreateScope())
                {
                    DbInitialize.EnsureSeedData(scope.ServiceProvider);
                    DbInitialize.EnsureIdentityServerDatabase(scope.ServiceProvider);
                }
                host.Run();
            }
            catch (Exception ex)
            {
                //NLog: catch setup errors
                logger.Error(ex, "Stopped program because of exception");
                throw;
            }
            finally
            {
                NLog.LogManager.Shutdown();
            }
        }