且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Ninject和ChildKernel在MVC3项目:"错误加载Ninject组件ICACHE"

更新时间:2022-12-09 23:04:17

因为你所有的扩展模块加载到内核孩子的异常。创建具有LoadExtensions内核= FALSE会解决这个问题。但是,这不是你的情况的解决方案。

The exception is thrown because you load all the modules from the extensions into the child kernel. Creating the kernel with LoadExtensions=false would fix that problem. But this is not the solution in your case.

在ChildKernel的意图是不是真的不同的范围。您将需要对这个孩子内核的任务注册的一切。就在会议将是不够的。只需添加一个有条件的会话绑定是迄今为止更好的选择。

The intention of the ChildKernel isn't really for different scoping. You would need to register everything for the tasks on that child kernel. Just the session won't be enough. Adding just a conditional binding for the session is far the better option.