且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Asp.net 核心标识“INSERT 语句与 FOREIGN KEY 约束冲突"

更新时间:2023-02-16 16:21:48

在出现错误之前检查 UserManager.CreateAsync 调用的输出.我猜您的用户没有得到持久化,因此下一次调用失败并出现 FK 问题.

Check the output of UserManager.CreateAsync call right before the error. I'm guessing your user doesn't get persisted so the next call fails with an FK issue.

如果您使用默认身份密码要求(就像我尝试时那样),您会从用户创建调用中得到密码验证错误结果.

If you are using the default identity password requirements (like I was when I tried it) you get a password validation error result from the user creation call.