title: Resolve controller: "Make sure that the controller has a parameterless public constructor"
body: <p>I have several Web API controllers in my project. After a lot of redundant code, I've refactored them into the code below, which seemed to be highly reusable. However, I'm suddenly getting the error <code>Make sure that the controller has a parameterless public constructor</code>, which seems to be caused by Ninject not being able to resolve the controller bindings. I'm not sure how to bind them.</p>
  
  <p>My code:</p>
  
  <pre><code>public interface IController&lt;T, TK&gt;
  {
      DataSourceResult Get(DataSourceRequest request);
      T Get(TK id);
      HttpResponseMessage Post(T model);
      T Put(T model);
      TK Delete(TK id);
  }
  
  public abstract class BaseController&lt;T, TK&gt; : ApiController, IController&lt;T, TK&gt;
  {
      private readonly IRepository&lt;T, TK&gt; repository;
  
      public BaseController(IRepository&lt;T, TK&gt; repository)
      {
          this.repository = repository;
      }
  
      /* methods here */
  }
  
  public class ReceiptsController : BaseController&lt;ReceiptViewModel, long&gt;
  {
      public ReceiptsController(IRepository&lt;ReceiptViewModel, long&gt; repository) :
          base(repository)
      {
      }
  }
  </code></pre>
  
  <p>In the ninject <code>RegisterServices</code> method, I've tried the following:</p>
  
  <pre><code>kernel.Bind&lt;IController&lt;OntvangstViewModel, long&gt;&gt;().To&lt;OntvangstenController&gt;();
  kernel.Bind&lt;BaseController&lt;OntvangstViewModel, long&gt;&gt;().To&lt;OntvangstenController&gt;();
  </code></pre>
  
  <p>But neither seem to work. Is my implementation or inheritance wrong? Or should I bind them differently?</p>