I want to host my WebApi project in IIS and Self-Host context. In my researches, For IIS hosting, I found these two packages:
1- Microsoft.AspNet.WebApi.WebHost (src)
This package contains everything you need to host ASP.NET Web API on IIS
2- Microsoft.Owin.Host.SystemWeb (src)
OWIN server that enables OWIN-based applications to run on IIS using the ASP.NET request pipeline.
My WebApi app can be loaded in IIS with both of them. So the question is what is the difference between these two packages and in which condition I should use them.
P.S. I get some error when hosting with second package in some scenarios.
This package Microsoft.Owin.Host.SystemWeb is required if you want to host Web.API on a OWIN pipeline and you are hosting this pipeline on IIS (you don't need this for self-hosting, for example inside a console app).
The other one is required for "classic" Web.API hosting and has nothing to do with OWIN itself.
I guess you want to run OWIN (because you're self hosting too), so you need the second one.
BTW, the OWIN equivalent of Microsoft.AspNet.WebApi.WebHost is Microsoft.AspNet.WebApi.Owin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With