错误加载Ninject组件ICACHE [英] Error loading Ninject component ICache

查看:260
本文介绍了错误加载Ninject组件ICACHE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个asp.net网页API项目中使用ninject,并已开始接受这种间歇ninject错误:

I am using ninject in an asp.net web api project and have started receiving this intermittent ninject error:

错误加载Ninject组件ICACHE
没有这样的组件已注册在内核中的组件容器。

我使用的是:


  • Ninject 3.0.1.10

  • Ninject.MVC3 3.0.0.6

  • Ninject.Web.Common 3.0.0.7

他们都带到我的项目的NuGet我加载我的IocConfig.RegisterIoc模块,并取得了其他任何更改或调整。

They are all brought into my project with NuGet I load my Modules in IocConfig.RegisterIoc and have made no other changes or tweaks.

这可能是无关的,但问题开始在大约在同一时间发生,我开始注射的iKernel到我的建设者之一。我没有设立看了关于特殊解析这一有约束力的。

It may be unrelated but the problem started occurring at around the same time as I started injecting IKernel into one of my constructors. I didn't set up a binding for this having read about the "special resolver".

我已经通过这里了一些类似的问题阅读:

I have read through a number of similar questions on here:

<一个href=\"http://stackoverflow.com/questions/5134630/ninject-error-loading-ninject-component-icache\">Ninject + QUOT;错误加载Ninject组件ICACHE&QUOT;

<一个href=\"http://stackoverflow.com/questions/10958445/ninject-and-childkernel-in-mvc3-project-error-loading-ninject-component-icache\">Ninject和ChildKernel在MVC3项目:&QUOT;错误加载Ninject组件ICACHE&QUOT;

<一个href=\"http://stackoverflow.com/questions/13732645/randomly-occurring-ninject-exception-error-loading-ninject-component-icache\">Randomly-Occurring Ninject例外:&QUOT;错误加载Ninject组件ICACHE&QUOT;

虽然在每种情况下的OP具有相同的错误我解决的办法是不恰当的 - 我不是创建子仁,我没有使用ninject的窃听版本。

Although in each of these cases the OP has the same error as me the solution is not appropriate - I am not creating child kernels and I'm not using the bugged version of ninject.

推荐答案

找到了解决方案,以为我会分享。

Found the solution and thought I would share.

问题是,我使用Ninject.MVC3这似乎是错的包Web的API。

The problem was that I was Using Ninject.MVC3 which seems to be wrong package for Web-API.

相反,我需要使用Ninject.Web.WebApi-RC包通过这个帖子描述:

Instead I need to use Ninject.Web.WebApi-RC package as described by this post:

<一个href=\"http://www.eyecatch.no/blog/2012/06/using-ninject-with-webapi-rc/\">http://www.eyecatch.no/blog/2012/06/using-ninject-with-webapi-rc/

我的步骤遵循一个固定的

Steps I followed for a fix are


  • 卸载Ninject.MVC3和Ninject.Web.Common

  • 删除所有来自App_Start文件夹中的文件ninject的。

  • 从安装的NuGet和Ninject.Web.Common Ninject.Web.WebApi-RC

  • 加载我模块NinjectWebCommon.RegisterServices()

这篇关于错误加载Ninject组件ICACHE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆