public static void Main(string[] args) { var host = BuildWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { DatabaseInitializer.Inicializar(services); } catch { var logger = services.GetRequiredService <ILogger <Program> >(); } } host.Run(); }