0

我在 MVC4 webapi 应用程序中通过 nuget 使用 ninject mvc3。没有对 global.asax 进行任何更改 我创建了一个 ninjectmode 并将其放在 bin 文件夹中。我注意到 NinjectWebCommon.cs 中的“bootstrapper.Initialize(CreateKernel)”行正在引发异常“序列不包含元素”。如果我删除包含我的 ninject 模块的 dll,错误就会消失。我究竟做错了什么?我希望能够使用 NinjectModules 来分离我的应用程序中的关注点。

4

1 回答 1

0

Figured it out. Apparently, when you add Ninject.MVC3 to a class library project via Nuget, it adds an "App_Start" folder similar to how it does for a web application project. This was causing the above error. I removed the App_Start folder and life is good once again.

于 2013-03-29T01:23:14.447 回答