小编Jas*_*son的帖子

迁移到Asp.Net Identity 2.0:未在AspNetUsers表中创建新列

当我尝试使用Identity 2.0和默认的MVC 5应用程序注册新用户时出现以下错误:

Invalid column name 'Email'.
Invalid column name 'EmailConfirmed'.
Invalid column name 'PhoneNumber'.
Invalid column name 'PhoneNumberConfirmed'.
Invalid column name 'TwoFactorEnabled'.
Invalid column name 'LockoutEndDateUtc'.
Invalid column name 'LockoutEnabled'.
Invalid column name 'AccessFailedCount'.
(repeats 2 more times, I have a total of 4 test users in AspNetUsers table.)
Run Code Online (Sandbox Code Playgroud)

我有一个小应用程序,我刚刚从MVC4/Identity 1.0升级到MVC5/Identity 2.0,所以我有Identity 1.0列(UserName,PasswordHash,SecurityStamp,Discriminator)工作.

  • 我正在使用带有标准Identity 1.0表的远程托管SQL2012数据库.
  • 我创建了一个"干净"的项目,注册了一个用户,它在localDB上运行良好.
  • 我在远程数据库上成功运行了"add-migration initial"和"update-database".
  • 我最初遵循这个官方指南,并且没有生成第5步中的代码.我尝试手动粘贴它并再次运行"update-database -verbose".似乎成功完成,但仍然得到错误.

感谢任何帮助!

migration和configuration.cs文件

internal sealed class Configuration : DbMigrationsConfiguration<FactBanker.Models.ApplicationDbContext>
{
    public Configuration()
    {
        AutomaticMigrationsEnabled = true;
    }

    protected …
Run Code Online (Sandbox Code Playgroud)

identity entity-framework asp.net-mvc-5

8
推荐指数
1
解决办法
1万
查看次数

标签 统计

asp.net-mvc-5 ×1

entity-framework ×1

identity ×1