I am not able to find the proper Unity configuration to get it to work with MvcMembership.
At this point, I am getting the following error message:
The type Boolean cannot be constructed. You must configure the container to supply this value.
Here is my code to register dependencies:
container.RegisterInstance<MembershipProvider>(Membership.Provider);
container.RegisterType<IMembershipSettings,AspNetMembershipProviderSettingsWrapper>();
container.RegisterType<IUserService, AspNetMembershipProviderWrapper>();
container.RegisterType<IPasswordService, AspNetMembershipProviderWrapper>();
container.RegisterType<IRolesService, AspNetRoleProviderWrapper>();
container.RegisterType<ISmtpClient, SmtpClientProxy>();
container.RegisterType<IRegistrationSettings, RegistrationSettings>();
And here is my Stack Trace:
[InvalidOperationException: The type Boolean cannot be constructed. You must configure the container to supply this value.] Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.GuardTypeIsNonPrimitive(IBuilderContext context, SelectedConstructor selectedConstructor) +277 Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.PreBuildUp(IBuilderContext context) +485 Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +434 Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext context, NamedTypeBuildKey buildKey) +400 Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) +222 Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +434 Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(NamedTypeBuildKey newBuildKey) +318 BuildUp_MvcMembership.Settings.RegistrationSettings(IBuilderContext ) +216 Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) +304 Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +434 Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(NamedTypeBuildKey newBuildKey) +318 BuildUp_MvcMembership.Settings.AspNetMembershipProviderSettingsWrapper(IBuilderContext ) +220 Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) +304 Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +434 Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(NamedTypeBuildKey newBuildKey) +318 BuildUp_MyProject.Web.Areas.MvcMembership.Controllers.UserAdministrationController(IBuilderContext ) +223 Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) +304 Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +434 Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +440
[ResolutionFailedException: Resolution of the dependency failed, type = "MyProject.Web.Areas.MvcMembership.Controllers.UserAdministrationController", name = "(none)". Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type Boolean cannot be constructed. You must configure the container to supply this value.
At the time of the exception, the container was:
Resolving MyProject.Web.Areas.MvcMembership.Controllers.UserAdministrationController,(none)
Resolving parameter "membershipSettings" of constructor MyProject.Web.Areas.MvcMembership.Controllers.UserAdministrationController(MvcMembership.Settings.IMembershipSettings membershipSettings, MvcMembership.IUserService userService, MvcMembership.IPasswordService passwordService, MvcMembership.IRolesService rolesService, MvcMembership.ISmtpClient smtpClient)
Resolving MvcMembership.Settings.AspNetMembershipProviderSettingsWrapper,(none) (mapped from MvcMembership.Settings.IMembershipSettings, (none))
Resolving parameter "registration" of constructor MvcMembership.Settings.AspNetMembershipProviderSettingsWrapper(MvcMembership.Settings.IRegistrationSettings registration, MvcMembership.Settings.IPasswordSettings password, MvcMembership.Settings.ILoginSettings login)
Resolving MvcMembership.Settings.RegistrationSettings,(none) (mapped from MvcMembership.Settings.IRegistrationSettings, (none))
Resolving parameter "requiresUniqueEmailAddress" of constructor MvcMembership.Settings.RegistrationSettings(System.Boolean requiresUniqueEmailAddress)
Resolving System.Boolean,(none)
]
Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable1 resolverOverrides) +546
Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable
1 resolverOverrides) +20
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +68
[InvalidOperationException: An error occurred when trying to create a controller of type 'MyProject.Web.Areas.MvcMembership.Controllers.UserAdministrationController'. Make sure that the controller has a parameterless public constructor.]
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +634403
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +93
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +346
System.Web.Mvc.<>c_DisplayClass6.b_2() +71
System.Web.Mvc.<>c__DisplayClassb1.<ProcessInApplicationTrust>b__a() +19
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func
1 func) +161
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +405
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375