I have ASP.NET Core 2.1 MVC Application. Also in database I have 1 user in role "Admin",but when I try to get list of users in database it returns an empty list.It normaly returns data from "Roles" and "UserRoles" tables, but is unable to see any data in "Users" table and, consequently I can't use SignInAsync, or PasswordSignInAsync methods. This is my dbContext:
public class AppDbContext : IdentityDbContext<User, Role, string>
{
public AppDbContext(DbContextOptions<AppDbContext> options):base(options)
{ }
// ...
}
And here is my Startup:
services.AddDbContext<AppDbContext>(options =>
{
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"));
});
services.AddIdentity<User, Role>()
.AddEntityFrameworkStores<AppDbContext>()
.AddDefaultTokenProviders();
// ...
Be sure to have NORMALIZEDUSERNAME and NORMALIZEDEMAIL with the same value on email and username in uppercase.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With