title: Relationship between Webapi, Webhost and Owin
body: <p>I'm just trying to get my head around relationship between webapi, webhost (iis) and owin. I'll write down my current understanding, and I ask you to tell me if it is correct or not.</p>
  
  <ul>
  <li><strong>Webapi</strong>, unlike MVC was written in host-independent manner. This was in pre-Owin days, but apparently they anticipated that Owin would happen sooner or later. Host independency mainly means that System.Web is not used anywhere in Webapi code. It is System.Web that relies solely on IIS and would not work without it. This way Webapi could be theoretically hosted anywhere - once other hosts become available. </li>
  <li><strong>Webhost</strong> (<code>Microsoft.Owin.Host.SystemWeb</code>, <code>Microsoft.AspNet.WebApi.WebHost</code>) is a layer to between a higher level API (such as Webapi) and the IIS. Since Webapi initially was host independent, an intermediate layer required to make it run on a particular host, such as IIS. Webhost for Webapi (<code>Microsoft.AspNet.WebApi.WebHost</code>) provided this layer. Later on there will also be Webhost layer for Owin (<code>Microsoft.Owin.Host.SystemWeb</code>), that would allow hosting anything Owin compatible on IIS.</li>
  <li><strong>Owin</strong> came around the last. It basically provided an abstraction that theoretically would allow hosting any Owin compatible application on any host as long as there is a layer between owin and that host. Owin came with Webhost (<code>Microsoft.Owin.Host.SystemWeb</code>) (similar to how Webapi came with Webhost) that allowed Owin apps to be hosted on IIS. It also came with self-host (<code>Microsoft.Owin.SelfHost</code>) that allowed Owin apps to be hosted inside any executable. As far as Webapi concerned, Owin also came with Owin host for Webapi (<code>Microsoft.AspNet.WebApi.Owin</code>) which allowed running WebApi on Owin stack.</li>
  </ul>
  
  <p>All the above means that one has two different ways of hosting Webapi on IIS. It can be done without Owin, using Webapi WebHost, or it can be done with Owin Host for Webapi and with Webhost for Owin.</p>
  
  <p>Nuget references:</p>
  
  <ul>
  <li><a href="https://www.nuget.org/packages/Microsoft.Owin.SelfHost/">Microsoft.Owin.SelfHost</a></li>
  <li><a href="https://www.nuget.org/packages/Microsoft.Owin.Host.SystemWeb/">Microsoft.Owin.Host.SystemWeb</a></li>
  <li><a href="https://www.nuget.org/packages/Microsoft.AspNet.WebApi.WebHost/">Microsoft.AspNet.WebApi.WebHost</a></li>
  <li><a href="https://www.nuget.org/packages/Microsoft.AspNet.WebApi.Owin/">Microsoft.AspNet.WebApi.Owin</a></li>
  </ul>
  
  <p>Is this understanding correct?</p>