Ninject + MVC3 = InvalidOperationException: Sequence contains no elements

前端 未结 7 919
借酒劲吻你
借酒劲吻你 2020-12-04 18:37

I created a new MVC3 project, hit F5, saw the sample page.

Then I used NuGet to get the Ninject.MVC extension. I modified my global.asax according to the Ninject doc

7条回答
  •  鱼传尺愫
    2020-12-04 19:08

    I have updated the documentation Wiki linked in your question to show both ways to setup a MVC3 application. I suggest to use the second option which is the prefered way for theNuGetpackage.

    Instead of deriving from NinjectHttpApplication it is using the NinjectMVC.cs in the AppStart folder which is created during installation of the package. This is also the location where you create the kernel and where you load your modules or where you define the bindings.

提交回复
热议问题