public static void Main(string[] args) { var host = BuildWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { var context = services.GetRequiredService <AppDbContext>(); DbInitalizer.Seed(context); } catch (Exception) { //fdvdfv } } host.Run(); }