asp.net - Relationship between Webapi, Webhost and Owin -


i'm trying head around relationship between webapi, webhost (iis) , owin. i'll write down current understanding, , ask tell me if correct or not.

  • webapi, unlike mvc written in host-independent manner. in pre-owin days, apparently anticipated owin happen sooner or later. host independency means system.web not used anywhere in webapi code. system.web relies solely on iis , not work without it. way webapi theoretically hosted anywhere - once other hosts become available.
  • webhost (microsoft.owin.host.systemweb, microsoft.aspnet.webapi.webhost) layer between higher level api (such webapi) , iis. since webapi host independent, intermediate layer required make run on particular host, such iis. webhost webapi (microsoft.aspnet.webapi.webhost) provided layer. later on there webhost layer owin (microsoft.owin.host.systemweb), allow hosting owin compatible on iis.
  • owin came around last. provided abstraction theoretically allow hosting owin compatible application on host long there layer between owin , host. owin came webhost (microsoft.owin.host.systemweb) (similar how webapi came webhost) allowed owin apps hosted on iis. came self-host (microsoft.owin.selfhost) allowed owin apps hosted inside executable. far webapi concerned, owin came owin host webapi (microsoft.aspnet.webapi.owin) allowed running webapi on owin stack.

all above means 1 has 2 different ways of hosting webapi on iis. can done without owin, using webapi webhost, or can done owin host webapi , webhost owin.

nuget references:

is understanding correct?

your understanding correct, role of owin seems misunderstood. more complete timeline be:

  1. owin standard developed describe generic .net web interface, la wsgi/rake/connect (first commit in 2010).
  2. asp.net webapi developed host-independent, released https://www.nuget.org/packages/microsoft.aspnet.webapi.webhost/.
  3. katana project implements several owin hosts:
    1. https://www.nuget.org/packages/microsoft.owin.selfhost/
    2. https://www.nuget.org/packages/microsoft.owin.host.httplistener/
    3. https://www.nuget.org/packages/microsoft.owin.host.iis/
    4. https://www.nuget.org/packages/microsoft.owin.host.systemweb/
  4. asp.net webapi adapter owin released: https://www.nuget.org/packages/microsoft.aspnet.webapi.owin.

your summary:

all above means 1 has 2 different ways of hosting webapi on iis. can done without owin, using webapi webhost, or can done owin host webapi , webhost owin.

i restate as:

all above means 1 has 2 different ways of hosting webapi. can done without owin, using webapi webhost, or can done owin adapter webapi , owin-compatible host. hosting options on iis microsoft.owin.host.iis , microsoft.owin.host.systemweb. microsoft.aspnet.webapi.owinselfhost provided.


Comments