I am trying to integrate Ninject v2 with my asp.net webforms project. I am running the .NET Framework 4.0.
My global.asax inherits from Ninject.Web.NinjectHttpApplication. I also added the CreateKernel method:
protected override IKernel CreateKernel()
{
IKernel kernel = new StandardKernel();
kernel.Bind<IUser>().To<User>();
return kernel;
}
All my pages inherit from Ninject.Web.PageBase. I also added the following httpmodule entry to my web.config:
<add name="NinjectHttpModule" type="Ninject.Web.NinjectHttpModule, Ninject.Web">
However, when I launch the application, an InvalidOperationException fires with the following:
"Type ASP.login_aspx requested an injection, but the kernel was not registered for the web application. Make sure your project defines NinjectHttpApplication.
What am I doing wrong?
Yours faithfully
Lee
source
share