title: Can't instantiate Controller with Castle using webapi as well
body: <p>I'm working in a project that uses both ApiControllers and Controllers (not webapi) with Castle (from Nuget)</p>
  
  <pre><code> internal class WebWindsorInstaller : IWindsorInstaller
      {
          public void Install(IWindsorContainer container, IConfigurationStore store)
          {
              container.Register(Component
                  .For&lt;RepositoryFactories&gt;()
                  .ImplementedBy&lt;RepositoryFactories&gt;()
                  .LifestyleSingleton());
  
              container.Register(Component
                  .For&lt;IRepositoryProvider&gt;()
                  .ImplementedBy&lt;RepositoryProvider&gt;()
                  .LifestylePerWebRequest());
  
              container.Register(Component
                  .For&lt;IProjUow&gt;()
                  .ImplementedBy&lt;ProjUow&gt;()
                  .LifestylePerWebRequest());
  
              container.Register(Classes
                  .FromAssemblyContaining&lt;Api.CategoriesController&gt;()
                  .BasedOn&lt;IHttpController&gt;()
                  .If(t =&gt; t.Name.EndsWith("Controller"))
                  .LifestylePerWebRequest());
  
              container.Register(Classes
                  .FromAssemblyContaining&lt;CategoriesController&gt;()
                  .BasedOn&lt;IController&gt;()
                  .If(t =&gt; t.Name.EndsWith("Controller"))
                  .LifestylePerWebRequest());
          }
      }
  </code></pre>
  
  <p>This in global.asax (Application_Start)</p>
  
  <pre><code>var container = new WindsorContainer().Install(new WebWindsorInstaller());
  GlobalConfiguration.Configuration.DependencyResolver = new WindsorDependencyResolver(container);
  </code></pre>
  
  <p>And this is the Controller constructor of CategoriesController</p>
  
  <pre><code>public class CategoriesController : ControllerBase
  {
      public CategoriesController(IProjUow uow)
      {
          Uow = uow;
      }
  }
  </code></pre>
  
  <p>And ControllerBase inherites from Controller</p>
  
  <p>The ApiController is defined as follows:</p>
  
  <pre><code>public abstract class ApiControllerBase : ApiController
  {
      protected IProjUow Uow { get; set; }
  }
  
  public class CategoriesController : ApiControllerBase
  {
      public CategoriesController(IProjUow uow)
      {
          Uow = uow;
      }
  }
  </code></pre>
  
  <p>The ApiController works ok, but the other one says:</p>
  
  <p>No parameterless constructor defined for this object.</p>
  
  <p>Why?</p>
  
  <p>Thanks in advance! Guillermo.</p>