I have the following packages and their dependencies installed in my WebAPI project:
Ninject.Web.WebApi
Ninject.Web.WebApi.OwinHost
This applies to older versions of Ninject, or if you are not using the auto-generated bootstrap code from Ninject.Web.WebApi.Webhost.
You are missing a dependency resolver, its a really basic implementation:
public class NinjectHttpDependencyResolver : IDependencyResolver, IDependencyScope
{
private readonly IKernel _kernel;
public NinjectHttpDependencyResolver(IKernel kernel)
{
_kernel = kernel;
}
public IDependencyScope BeginScope()
{
return this;
}
public void Dispose()
{
//Do nothing
}
public object GetService(Type serviceType)
{
return _kernel.TryGet(serviceType);
}
public IEnumerable
Then just register it when you create the kernel:
var httpResolver = new NinjectHttpDependencyResolver(kernel);
GlobalConfiguration.Configuration.DependencyResolver = httpResolver;