- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
为什么在 .NET Core Identity 上使用 PasswordSignInAsync 时出现异常? Microsoft.AspNetCore.Identity
await _signInManager.PasswordSignInAsync(user.UserName, Input.Password, Input.RememberMe, lockoutOnFailure: false);
An unhandled exception occurred while processing the request.
SqlException: Invalid column name 'NormalizedName'.
Invalid column name 'ConcurrencyStamp'.
Invalid column name 'NormalizedName'.
Microsoft.Data.SqlClient.SqlCommand+<>c.<ExecuteDbDataReaderAsync>b__164_0(Task<SqlDataReader> result)
我可以创建用户、重置密码等等。 “NormalizedName
”甚至不是 Microsoft.AspNetCore.Identity
的一部分。我的表中存在所有列
select LockoutEnd, TwoFactorEnabled, PhoneNumberConfirmed, PhoneNumber, ConcurrencyStamp, SecurityStamp,
PasswordHash, EmailConfirmed, NormalizedEmail, Email, NormalizedUserName, UserName, Id, LockoutEnabled, AccessFailedCount
from [dbo].[AspNetUsers]
最佳答案
异常实际上来自 AspNetRoles
表,而不是 AspNetUsers
表。如果您已将旧的 Asp.Net Identity
迁移到 Asp.Net Core,则需要将两个新字段添加到 Roles 表中。这是一个迁移:
public partial class Identity : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "NormalizedName",
table: "AspNetRoles",
type: "nvarchar(256)",
maxLength: 256,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ConcurrencyStamp",
table: "AspNetRoles",
type: "nvarchar(max)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ConcurrencyStamp",
table: "AspNetRoles");
migrationBuilder.DropColumn(
name: "NormalizedName",
table: "AspNetRoles");
}
}
如果您想要完整的Identity
迁移,包括用户、声明和其他表,您可以引用我对这个问题的回答:https://stackoverflow.com/a/65003440/1348324
关于asp.net - SqlException : Invalid column name 'NormalizedName' . 无效的列名 'ConcurrencyStamp'。无效的列名 'NormalizedName',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63456536/
为什么在 .NET Core Identity 上使用 PasswordSignInAsync 时出现异常? Microsoft.AspNetCore.Identity await _signInMa
我使用了带有 Firebase 云功能的 SendGrid NodeJS 库。它工作正常,我可以发送电子邮件。但是在 Cloud 函数下方发生火灾后,它在 Ionic/Angular 客户端应用程序的
我是一名优秀的程序员,十分优秀!