title: Middleware class not called on api requests
body: <p>I've created a basic webAPI project (blank web project with webAPI checked) and added the owin nuget packages to the project.</p>
  
  <ul>
  <li>Microsoft.AspNet.WebApi.Owin</li>
  <li>Microsoft.Owin.Host.SystemWeb</li>
  <li>Owin</li>
  </ul>
  
  <p>I've then created a Logging class, and hooked it up via startup</p>
  
  <pre><code>using AppFunc = System.Func&lt;System.Collections.Generic.IDictionary&lt;string, object&gt;, System.Threading.Tasks.Task&gt;;
  
  public class Startup
  {
      public void Configuration(IAppBuilder appBuilder)
      {
          Debug.WriteLine("Startup Called");
          var config = new HttpConfiguration();
          WebApiConfig.Register(config);
  
          appBuilder.UseWebApi(config);
  
          appBuilder.Use(typeof(LoggingMiddleware));
      }
  }
  
  public class LoggingMiddleware
  {
      private AppFunc Next { get; set; }
  
      public LoggingMiddleware(AppFunc next)
      {
          Next = next;
      }
  
      public async Task Invoke(IDictionary&lt;string, object&gt; environment)
      {
          Debug.WriteLine("Begin Request");
  
          await Next.Invoke(environment);
  
          Debug.WriteLine("End Request");
      }
  }
  </code></pre>
  
  <p>When I run the project, and the default page opens, I see the Begin/End requests called (twice, as it happens, not sure why that is).</p>
  
  <p>However, if I try to call an <code>/api</code> route (such as `/api/ping/'), the request completes successfully, but I do not see the Begin/End request states in the log.</p>
  
  <p>What am I missing with this?</p>