Reputation: 4297
I'm finding more and more packages for ASP.NET are being offered as OWIN middleware. In some cases there's both an OWIN version and "traditional" version, in some cases there's only the OWIN option. This has led to my ASP.NET Web API application using two different "startup" configuration styles. The traditional configuration for ASP.NET Web API, and OWIN for everything else. I want to consolidate on the OWIN configuration style, but how should I be configuring ASP.NET Web API 2 for hosting in IIS using OWIN?
Everything I read about using OWIN for ASP.NET Web API 2 references the IAppBuilder
extension method UseWebApi(HttpConfiguration configuration)
. But that extension method is in the Microsoft.AspNet.WebApi.OwinSelfHost
NuGet package. It appears I can use that package in an IIS host and move away from using System.Web.Http.GlobalConfiguration
, but the name "Self Host" is leaving me with doubts.
Is this a recognised approach? Are there gotchas I should know of? Why does the default "File > New Project" in VS2015 not take this approach for Web API configuration, while it does use OWIN configuration for authentication middleware?
Upvotes: 3
Views: 2192
Reputation: 56
The IAppBuilder
extension method UseWebApi(HttpConfiguration configuration)
is in the Microsoft.AspNet.WebApi.Owin
package not in the Microsoft.AspNet.WebApi.OwinSelfHost
Upvotes: 3