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?

有帮助吗?

解决方案 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.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top