I got this code in my Startup.cs:
services.AddDbContext(options =>
options.UseSqlServer(Configuration.GetConnecti
You have to create the IServiceScope on your own.
To do this you have to replace
var roleManager = serviceProvider.GetService<RoleManager<ApplicationRole>>();
with
using (IServiceScope scope = app.ApplicationServices.CreateScope()) {
RoleManager<IdentityRole> roleManager = scope.ServiceProvider.GetRequiredService<RoleManager<IdentityRole>>();
// Seed database code goes here
}