I want to use Ninject in a project which combines ASP.Net webforms and ASP.Net MVC. I'm using Ninject 2, but when I use NinjectHttpApplication from Ninject.Web.Mvc it complains when I use somethings like a PageBase that the Kernel is not created.
I have the following in the Global.asax and am unsure what to add.
public class MvcApplication : Ninject.Web.Mvc.NinjectHttpApplication
{
protected override void OnApplicationStarted()
{
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
RegisterAllControllersIn(Assembly.GetExecutingAssembly());
}
protected override Ninject.IKernel CreateKernel()
{
return new StandardKernel(new ServiceModule());
}
}
Does somebody has this working somewhere who could share some thoughts or code on this?