NinjectDependencyResolver fails binding ModelValidatorProvider

前端 未结 10 1562
迷失自我
迷失自我 2020-12-08 14:00

I\'m developing an ASP.NET Web Api 2.2 with C#, .NET Framework 4.5.1.

After updating my Web.Api to Ninject 3.2.0 I get this error:

Error activating M         


        
10条回答
  •  臣服心动
    2020-12-08 14:40

    Be sure that any old Ninject or Ninject.Web.Common.* dlls aren't present in your bin folder.

    I had the same issue in my solution after I had uninstalled Ninject.Web.Common, Ninject.Web.Common.WebHost, Ninject.Web.WebApi, and Ninject.MVC5 from Nuget and installed WebApiContrib.IoC.Ninject in order to use GlobalConfiguration.Configuration.DependencyResolver as in your example. I kept the version of Ninject that I already had installed (which was indeed 3.2.2).

    The error did not appear when I first made my changes. However, after moving around from a few git branches and back to my current work, I saw the error. The code that had run fine last week was now throwing the same exact error.

    It seems that my bin folder had references to the old Ninject.* packages I had removed. Upon deleting those files, my project worked as expected.

提交回复
热议问题