Exception has been thrown by the target of an invocation- while creating the controller

前端 未结 2 1516
走了就别回头了
走了就别回头了 2021-01-26 01:02

I am a beginner in ASP.NET MVC 5 and I was building a small application. While I was adding a controller a message popped up saying: \"There was an error running the selected co

2条回答
  •  野性不改
    2021-01-26 01:13

    Make sure you set throwIfV1Schema to false in the constructor of your DbContext, e.g.

    public class ApplicationDbContext : IdentityDbContext
    {
        public ApplicationDbContext() : base("DefaultConnection", throwIfV1Schema: false) { }
    
        public static ApplicationDbContext Create()
        {
            return new ApplicationDbContext();
        }
    }
    

提交回复
热议问题