Ninject in ASP.NET MVC4

前端 未结 8 1954
终归单人心
终归单人心 2021-02-07 03:19

So after much screwing around I finally got Ninject wired in and compiling in my MVC4 application. The problem I was running into is the IDependencyScope interface no longer ex

8条回答
  •  北恋
    北恋 (楼主)
    2021-02-07 04:00

    I tend to keep my Ninject bootstrapping in a separate project. In order to use the .InRequestScope() extension method of IBindingInSyntax, I had added via Nuget the Ninject.Web.Common library. Alas, this library includes the app_start bootstrapper, resulting in duplicate NinjectWebCommon classes and attachment via WebActivator (1 in said project and 1 in the MVC project itself).

    I deleted the duplicate App_Start folder from my bootstrap project, and this solved it.

提交回复
热议问题