Monday, July 25, 2016

Ensure that you have defined a binding for HttpConfiguration only once

I was recently working on adding Ninject to an ASP.NET Web API web application, when I suddenly encountered the following error message:

Well, as it turns out, after adding the Ninject.Web.WebApi.WebHost NuGet package reference, I also had a reference to Ninject.Web.WebApi which was causing the HttpConfiguration to be injected twice!

I had originally added the Ninject.Web.WebApi.WebHost NuGet package reference so that the NinjectWebCommon.cs file would be added automatically to my App_Start directory for injecting my dependencies.

Once that file was added, I no longer needed this NuGet package reference, so I went ahead and removed it and I could successfully browse my ASP.NET Web API Web Application once again!

1 comment:

  1. Bluehost is ultimately the best hosting company for any hosting plans you need.