Anybody know how to configure Membership.Provider in RegisterServices of ninject initialization code?
In my code:
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
// Put additional bindings here
kernel.Bind<IDatabaseFactory>().To<DatabaseFactory>();
kernel.Bind<IUnitOfWork>().To<UnitOfWork>();
kernel.Bind<IUserRepository>().To<UserRepository>();
kernel.Bind<IRoleRepository>().To<RoleRepository>();
kernel.Bind<ISecurityService>().To<SecurityService>();
kernel.Inject(Membership.Provider);
kernel.Inject(Roles.Provider);
}
all modules are binded with the exception of kernel.Inject lines. I'm receiving the error: "This method cannot be called during the application's pre-start initialization stage".
The file is NinjectWebCommon of a standard nuget ninject.mvc installation. I'm trying to create a custom membership provider and injecting the service layer (SecurityService) in the provider.
Any help?