Migrating from OWIN to ASP.NET Core

Brent Arias picture Brent Arias · Mar 14, 2016 · Viewed 30k times · Source

When moving from OWIN to ASP.NET Core, I've found a bit of information about dependencies to migration, but I've not found information about these other topics:

  • The middle-ware pipeline. How is this different, or not?
  • The DelegatingHandler pipeline (e.g. Web API). How is this different, or not?
  • The startup.cs file. How is this different?

In short, it would be great to know what are the primary hot-spots that would need my attention, in order to move from OWIN to ASP.NET Core.

As a first example - ASP.NET Core does not appear to have HttpConfiguration. There are myriads of example plugins and services that assume its existence. I'd like to infer how to translate instructions for HttpConfiguration into whatever approach ASP.NET Core expects.

As another example, the Swashbuckle documentation gives instructions for setup with OWIN, but those instructions don't work with ASP.NET Core. If I understood the primary differences from OWIN, it would be easier to "guesstimate" how to install Swashbuckle into ASP.NET Core.

  • Note: Swashbuckle also gives instructions for self-hosted apps. That confuses me because I think of OWIN (vis-a-vis Katana) as being self-hosted already, and so it sounds redundant to me. But I don't think this is related to the present question.

My question has used Swashbuckle as an example, but I am not asking about Swashbuckle specifically.

Update

I've discovered that much of the information I'm looking for is in the article Transitioning from Web API 2 to ASP.NET MVC 6.

Answer

Tratcher picture Tratcher · Mar 15, 2016
  • Middleware is quite similar between Katana and Core but you use HttpContext instead of IOwinContext.
  • Startup.cs is similar but there's much more DI support.
  • WebApi has been merged into MVC
  • DelegatingHandler is gone, use middleware instead.
  • HttpConfiguration has been split up into Routing and MvcOptions.

Also https://devblogs.microsoft.com/aspnet/katana-asp-net-5-and-bridging-the-gap/