Question

I've been getting the following error:

System.InvalidOperationException: Error loading Ninject component ICache
No such component has been registered in the kernel's component container.

Using the following NuGet packages:

  • Ninject 3.0.1.10
  • Ninject.MVC3 3.0.0.6
  • Ninject.Web.Common 3.0.0.7
  • ASP.NET MVC 4.0.30506.0

The Binding are setup using WebActivator and the Ninject Bootstrapper (default setup).

It appears this error was once an issue before Ninject 2.2.1.0 and Ninject.MVC3 2.2.1.0 were released and this article is similar but I'm not using Web.Api Error loading Ninject component ICache.

It might be worth noting that I have two Kernels. The main kernel is created at application start-up and is disposed on shutdown. The second kernel us used during start-up but is disposed almost immediately as it's not needed again. So would this possibly cause the issue?

Was it helpful?

Solution 2

It turns out the issue was due to the fact that there were two Kernels. They must have been conflicting somehow, I didn't determine the cause and opted to remove the second Kernel.

OTHER TIPS

In my case this was because I was following someone's System.Web.Http.Dependencies.IDependencyResolver Ninject wrapper where the Dispose() method would call dispose on the kernel.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top