gpt4 book ai didi

ninject.web.mvc - ASP.NET MVC 加载 Ninject 组件 ICache 时出错

转载 作者:行者123 更新时间:2023-12-02 21:36:12 25 4
gpt4 key购买 nike

我收到以下错误:

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

使用以下 NuGet 包:

  • 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

使用 WebActivator 和 Ninject Bootstrapper 设置绑定(bind)(默认设置)。

看来这个错误在 Ninject 2.2.1.0 and Ninject.MVC3 2.2.1.0 were released 之前就曾经是一个问题。和这篇文章类似,但我没有使用 Web.Api Error loading Ninject component ICache .

值得注意的是,我有两个内核。主内核在应用程序启动时创建,并在应用程序关闭时释放。我们在启动期间使用了第二个内核,但由于不再需要它,因此几乎立即被丢弃。那么这可能会导致问题吗?

最佳答案

就我而言,这是因为我关注 someoneSystem.Web.Http.Dependency.IDependencyResolver Ninject 包装器,其中 Dispose() 方法将在内核上调用 dispose。

关于ninject.web.mvc - ASP.NET MVC 加载 Ninject 组件 ICache 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21325637/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com