Wednesday 1 July 2015

GlobalConfiguration.Configuration.DependencyResolver not found WebAPI

In my recent project , I found an interesting issue thought of posting it in my blog. 
May be , this post will help other guys who are searching after the same issue.

GlobalConfiguration.Configuration.DependencyResolver not found

My project required dependency injection with Ninject. During registration of all the repositories to the kernel in Ninject configuration this issue came up.

I searched the reason and did'nt found the reason . Later after searching for one hour, I came to know the reason that the project was basically started as MVC project and required with WebAPI also.

Then the answer is simple , GlobalConfiguration is from the NameSpace  System.Web.Http of WebApi Which is missing.

To avoid this problem , 
Open Package Manager Console and type this in it

Install-Package Microsoft.AspNet.WebApi.WebHost

The issue will be resolved. (Don't forget to add the Namespace)

I hope this post may help you guys.