Hello,
i am using:-
- asp.net mvc rc 2
- Ninject and ninject asp.net mvc extension (http://github.com/enkari/ninject.web.mvc)
i keep getting the 'No parameterless constructor defined for this object.' for my AccountController. The AccountController is injected with Services. The bindings for these services are defined in the ServiceModule.
Find below the code for my MvcApplication in Global.asax.cs.
public class MvcApplication : NinjectHttpApplication // System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Account", action = "Login", id = "" } // Parameter defaults
);
}
protected override void OnApplicationStarted()
{
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
RegisterAllControllersIn(Assembly.GetExecutingAssembly());
}
protected override IKernel CreateKernel()
{
return new StandardKernel(new INinjectModule[] {
new ServiceModule(),
});
}
}