Ninject.ActivationException thrown only on first web request (WebAPI 2, OWIN 3, Ninject 3)

[亡魂溺海] 提交于 2019-11-28 09:38:04

What version of the Ninject.Web.WebApi library are you using? it looks like 2 weeks ago a change was made to move some things around. before this change (v3.2.3 and earlier), HttpConfiguration bindings were present in 2 different modules in Ninject.Web.WebApi.OwinHost.OwinWebApiModule and Ninject.Web.WebApi.WebApiModule. after this change (new version is 3.2.4), this binding only happens once.

I had the same error, but for a different reason: for some reason I had installed both Ninject.Web.WebApi.WebHost and Ninject.Web.WebApi.OwinHost.

If you look in source for OwinWebApiModule.cs and WebApiWebHostModule.cs, both Ninject modules have a binding for HttpConfiguration.

I removed Ninject.Web.WebApi.WebHost and all is well.

Debendra Dash

Go to the Referances and search for Ninject.web.WebApi.WebHost and then remove this.Thats all it will start working.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!