public static void Main(string[] args) { var webHost = CreateHostBuilder(args).Build(); using (var scope = webHost.Services.CreateScope()) { var userManager = scope.ServiceProvider.GetRequiredService <UserManager <IdentityUser> >(); var rolerManager = scope.ServiceProvider.GetRequiredService <RoleManager <IdentityRole> >(); var options = scope.ServiceProvider.GetRequiredService <IOptions <AppSettings> >(); var authUser = new AuthUser(userManager, rolerManager, options); authUser.CreateDefaultRoles().Wait(); authUser.CreateDefaultUserAdminMaster("*****@*****.**", "#Qaz123890").Wait(); } webHost.Run(); }