title: Ninject throws Activation Exception in a WebApi project with multiple assemblies
body: <p>My asp.net WebApi project comprises of multiple assemblies for Services, Core and Data Access. In an attempt to use Ninject as my DI container in the project, I added Ninject.Web.Common package from NuGet. Then, I Implemented IDependencyResolver as:</p>
  
  <pre><code>public class NinjectDependencyResolver : NinjectDependencyScope, IDependencyResolver
  {
      readonly IKernel kernel;
  
      public NinjectDependencyResolver(IKernel kernel) : base(kernel)
      {
          this.kernel = kernel;
      }
  
      public IDependencyScope BeginScope()
      {
          return new NinjectDependencyScope(this.kernel.BeginBlock());
      }
  }
  
  public class NinjectDependencyScope : IDependencyScope
  {
      IResolutionRoot resolver;
  
      public NinjectDependencyScope(IResolutionRoot resolver)
      {
          this.resolver = resolver;
      }
  
      public object GetService(System.Type serviceType)
      {
          if (resolver == null)
              throw new ObjectDisposedException("this", "This scope has been disposed");
  
          var resolved = this.resolver.Get(serviceType);
          return resolved;
      }
  
      public System.Collections.Generic.IEnumerable&lt;object&gt; GetServices(System.Type serviceType)
      {
          if (resolver == null)
              throw new ObjectDisposedException("this", "This scope has been disposed");
  
          return this.resolver.GetAll(serviceType);
      }
  
      public void Dispose()
      {
          IDisposable disposable = resolver as IDisposable;
          if (disposable != null)
              disposable.Dispose();
  
          resolver = null;
      }
  }
  </code></pre>
  
  <p>Here is my Ninject.Web.Common.cs.</p>
  
  <pre><code>public static class NinjectWebCommon 
  {
      private static readonly Bootstrapper bootstrapper = new Bootstrapper();
  
      /// &lt;summary&gt;
      /// Starts the application
      /// &lt;/summary&gt;
      public static void Start() 
      {
          DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));
          DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule));
          bootstrapper.Initialize(CreateKernel);
      }
  
      /// &lt;summary&gt;
      /// Stops the application.
      /// &lt;/summary&gt;
      public static void Stop()
      {
          bootstrapper.ShutDown();
      }
  
      /// &lt;summary&gt;
      /// Creates the kernel that will manage your application.
      /// &lt;/summary&gt;
      /// &lt;returns&gt;The created kernel.&lt;/returns&gt;
      private static IKernel CreateKernel()
      {
          var kernel = new StandardKernel();
          kernel.Bind&lt;Func&lt;IKernel&gt;&gt;().ToMethod(ctx =&gt; () =&gt; new Bootstrapper().Kernel);
          kernel.Bind&lt;IHttpModule&gt;().To&lt;HttpApplicationInitializationHttpModule&gt;();
          RegisterServices(kernel);
  
          GlobalConfiguration.Configuration.DependencyResolver = new NinjectDependencyResolver(kernel);
          return kernel;
      }
  
      /// &lt;summary&gt;
      /// Load your modules or register your services here!
      /// &lt;/summary&gt;
      /// &lt;param name="kernel"&gt;The kernel.&lt;/param&gt;
      private static void RegisterServices(IKernel kernel)
      {
          kernel.Bind(x =&gt;
              x.FromAssembliesInPath(AppDomain.CurrentDomain.RelativeSearchPath)
              .SelectAllIncludingAbstractClasses()
              .BindDefaultInterface()
              .Configure(config =&gt; config.InSingletonScope()));
  
          //kernel.Bind(x =&gt; 
          //    {
          //        x.FromAssembliesMatching("*")
          //        .SelectAllClasses()
          //        .BindDefaultInterface()
          //        .Configure(b =&gt; b.InTransientScope());
          //    });
          //kernel.Load()
          //kernel.Bind&lt;ISecurityService&gt;().To&lt;SecurityServiceImplementation&gt;();
  
          //kernel.Bind(x =&gt; x
          //    .FromAssembliesMatching("*")
          //    .SelectAllClasses()
          //    .BindDefaultInterface());
          //.Configure(b =&gt; b.InTransientScope()));
          //kernel.Load("*.dll");
      }        
  }
  </code></pre>
  
  <p>exception is </p>
  
  <pre><code>[ActivationException: Error activating IHostBufferPolicySelector
  No matching bindings are available, and the type is not self-bindable.
  Activation path:
  1) Request for IHostBufferPolicySelector
  </code></pre>
  
  <p>I have used various registrations (commented out) but none work. The break point in NinjectWebCommon.cs -> CreateKernel() method is hit and so does the break point in GetService(System.Type serviceType) method. AppDomain.CurrentDomain.RelativeSearchPath resolves to the bin directory of the app and it contains all the dlls including System.Web.Http.dll which contains the IHostBufferPolicySelector type. </p>
  
  <p>How can I properly use the Ninject.Extensions.Conventions to setup the kernel for type resolution? </p>