title: How to resolve handler mapping issues for WebAPI + OData + Owin + Ninject
body: <p>I posted this yesterday ...</p>
  
  <p><a href="https://stackoverflow.com/questions/32615769/owin-webapi-odata-v4-aspnet-identity-initialisation">https://stackoverflow.com/questions/32615769/owin-webapi-odata-v4-aspnet-identity-initialisation</a></p>
  
  <p>If I change the first line of the startup configuration method to ...</p>
  
  <pre><code>var config = GlobalConfiguration.Configuration ?? new HttpConfiguration();
  </code></pre>
  
  <p>Then I get this error where navigating to the root ...</p>
  
  <blockquote>
    <p>The 'DelegatingHandler' list is invalid because the property
    'InnerHandler' of 'CorsMessageHandler' is not null. Parameter name:
    handlers</p>
  </blockquote>
  
  <p>I found some information dotted about that suggested that the base implementation of "HttpServer" had a bug in it related to batching and that microsoft had said they implemented some new batching framework so wern't going to fix it, the blogs offered up this code sample to fix the bug ...</p>
  
  <pre><code>public class BatchServer : HttpServer
  {
      private readonly HttpConfiguration _config;
  
      public BatchServer(HttpConfiguration configuration)
          : base(configuration)
      {
          _config = configuration;
      }
  
      protected override void Initialize()
      {
          var firstInPipeline = _config.MessageHandlers.FirstOrDefault();
          if (firstInPipeline != null &amp;&amp; firstInPipeline.InnerHandler != null)
          {
              InnerHandler = firstInPipeline;
          }
          else
          {
              base.Initialize();
          }
      }
  }
  </code></pre>
  
  <p>Apparently this doesn't seem to be solving my problem. </p>
  
  <p>So, i'm stuck between these two errors with no idea how to get out.</p>