asp.net identity 2.0 unity not resolving default user store

前端 未结 2 456

i get the following exception when trying to configure Unity using Unity.Mvc5 with an MVC 5 application using Identity 2.0 and the Identity 2.0 Samples boilerplate. i have read

2条回答
  •  北海茫月
    2021-02-02 02:42

    I see you found a solution, but I think I have a simpler one.

    You're using Entity Framework, right? So your application almost certainly has something inheriting from DbContext (probably inheriting from IdentityContext, which in turn inherits from DbContext in this case). In the default template it's ApplicationDbContext.

    In your composition root you can just add container.RegisterType(new HierarchicalLifetimeManager()); (obviously edit this if yours isn't called ApplicationDbContext).

提交回复
热议问题