“Context cannot be used while the model is being created” exception with ASP.NET Identity

后端 未结 7 1255
遥遥无期
遥遥无期 2020-12-01 07:42

Why is this happening when we make a call to the AccountApiController.Register() method?

  • what is trying to use the context?
  • what is trying to create
7条回答
  •  执笔经年
    2020-12-01 07:47

    Do you override the OnModelCreating method? If so, can you share it or the whole context class?

    If not, you should pay attention to the following in the error message

    or if the same context instance is accessed by multiple threads concurrently. Note that instance members of DbContext and related classes are not guaranteed to be thread safe.

    If that doesn't help, do you use an unchanged Web API project which is created by Visual Studio?

提交回复
热议问题