title: Dependency Injection for Handlers and Filters in ASP.NET Web API
body: <p>I am trying to wire up my Web Api project to use Castle Windsor for IoC</p>
  
  <p>I have done that for my controllers by following <a href="http://blog.ploeh.dk/2012/10/03/DependencyInjectionInASPNETWebAPIWithCastleWindsor.aspx" rel="noreferrer">this excellent article</a>.</p>
  
  <p>I am now trying to get dependencies injected into my DelegatingHandler and ActionFilterAttribute</p>
  
  <p>I have tried to copy the techniques used for filters in regular ASP.Net MVC but they don't seem to apply in Web Api</p>
  
  <p>has anyone managed to get this working?</p>
  
  <p>I'm not sure what the relevant extension point is in the Web Api</p>
  
  <p>I have seen this being suggested</p>
  
  <pre><code>config.MessageHandlers.Add(_myContainer.Resolve&lt;IApiUsageLogger&gt;());
  </code></pre>
  
  <p>but not sure if there is a better way.
  I would prefer to tap into the mechanism that creates these handlers/filters</p>
  
  <p>As this smells of Service Location for lots of handlers. 
  Is there a single point that all handlers are created?</p>
  
  <p>any ideas?</p>