Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.It is possible to migrate from Katana (Microsoft’s OWIN implementation) to ASP.NET Core. The secret is in still using the full .NET Framework.
Full Framework?I recently spoke at the Windsor-Essex .NET Developers group and was explaining to some developers that ASP.NET Core could run on the full .NET Framework. The reaction I got was slight confusion. Based on this, I assume there are others that were unaware of this. The other issue is the term “Full Framework”. I’m not sure if this is the common term, but I have heard it from many as reference to the .NET Framework that comes shipped with Windows. This is the framework most are using today.
Why?The reason you may want to use ASP.NET Core with Full Framework is because you are already using an Owin implementation like Katana. I’ve previously blogged about how you can use Katana to Self Host ASP.NET Web API as well as NancyFX ASP.NET Core supports Owin Middleware. Which means you could migrate your Katana Self Host to use ASP.NET Core with Kestrel.
File > New ProjectIf you haven’t already, you need to install the .NET Core SDK for Visual Studio. As of this post, 2016-07-06, Visual Studio 2015 Update 3 has the latest bits. When you create a new project in Visual Studio, you have the option of created a ASP.NET Core app, but using .NET Full Framework. In this example I’m going to create a empty web application. The next step is to install the Microsoft.AspNetCore.Owin package from Nuget. This will enable use to Owin Middleware from ASP.NET Core’s IApplicationBuilder.
NancyAs you may have already seen on my blog, I’m a fan of Nancy and have been using it with Katana for awhile now. In order to use Nancy with ASP.NET Core, we can install the same packages we needed when using it with Katana.
Install-Package Nancy Install-Package Nancy.OwinNow in our Startup.cs we can add Owin to our pipeline which then can call Nancy.