初始化ninject当'序列不包含任何元素'例外 [英] ' Sequence contains no elements' exception when initializing ninject
问题描述
我有Ninject一个问题,我以前没见过,不知道如何解决。我使用了MVC的NuGet包MVC 5
I have a problem with Ninject which I have not seen before and don't know how to fix. I am using the MVC NuGet package for MVC 5.
在我NinjectWebCommon.cs,有以下方法:
In my NinjectWebCommon.cs, there is the following method:
public static void Start()
{
DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));
DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule));
bootstrapper.Initialize(CreateKernel);
}
然而,它试图执行的最后一行时,抱怨倒下了序列不包含任何元素。我以前使用Unity为DI,但已更改为Ninject。
However, it falls over when trying to execute the last line, complaining that the "sequence contains no elements". I was previously using Unity for DI but have changed to Ninject.
任何想法?
谢谢,中号
推荐答案
我觉得这是这个问题的欺骗:的 Ninject + MVC3 = InvalidOperationException异常:序列包含
I think this is a dupe of this question: Ninject + MVC3 = InvalidOperationException: Sequence contains no elements
TL没有元素; DR - 确保你清除掉所有旧的DLL当您发布网站。
TL;DR - make sure you clear out all old dlls when you publish your site.
这篇关于初始化ninject当'序列不包含任何元素'例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!