Showing posts with label asp.net mvc user role error. Show all posts
Showing posts with label asp.net mvc user role error. Show all posts

Tuesday, July 12, 2016

"The type IUserStore`1 does not have an accessible constructor " Error when implementing default Identity Role in ASP.NET MVC Application

System.InvalidOperationException: The type IUserStore`1 does not have an accessible constructor. 



The AccountController class has two constructors, a default one with no parameter and another expecting a UserManager<T> object.when the class gets instantiated, Unity takes by default the one with the most parameters.

Hence,In the location where the types are registered in the Unity container (var container = new UnityContainer()) for global.asax,cs ,the following line has to be added :-

container.RegisterType<AccountController>(new InjectionConstructor());