【发布时间】:2019-04-23 20:50:25
【问题描述】:
我正在使用 asp.net core 2.2。 为从 IdentityUser 继承的应用程序用户使用自定义类时,注册和密码登录失败,并显示消息“SqlException:无效的列名 'ApplicationUserId'”。
Statrup.cs
services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
应用程序用户类
public class ApplicationUser : IdentityUser
{
}
数据库是标准身份生成的,没有添加自定义列。
【问题讨论】:
-
您是否已运行迁移并更新数据库以同步您的模型和数据库?是否有任何详细步骤可以重现您的问题?对于错误消息,您使用了 .net core 2.0 标识中的
AccountController。对于 .net core 2.2,默认标识是带有LoginModel的库。您是否从 .net core 2.0 迁移到 .net core 2.2?
标签: asp.net-core asp.net-identity basic-authentication