Thursday, December 11, 2014

OWIN and Katana

I've been trying to learn more about OWIN and Katana so let me see if I can break it down here for you.

OWIN is Open Web Interface for .NET. It is a specification for how a web application interact with a web server. It creates an abstraction between web servers and framework components. On top of that it was designed to be simple and have few dependencies on other frameworks. What this allows is for new components to be more easily developed because you don't have a tight coupling to another framework. It also decouples your .Net web sites from IIS so you can run them on other servers/platforms or self host them.

OWIN uses the concept of a pipeline through which requests and responses are passed. OWIN components in the pipeline do something with the request and response and the result is sent back to the user.

Katana on the other hand is Microsoft's implementation of a set of OWIN components.These components include things from servers and hosts to components such as authentication and bindings to frameworks. It is designed to be composed of a number of small focused components that can be added in as needed. This makes your application more efficient because it doesn't have a bunch of things it doesn't need in the pipeline. These components are added via Nuget packages.

You'll often hear the term "middleware" when working with Katana. This is simply one of the logical layers of a Katana application. From bottom to top the layers are Host, Server, Middleware and Application. So as you can see middleware is in the middle between the host/server and your application. This is where the OWIN pipeline components that your application depends on live. These components are specified in your application's startup code. These components can be as simple as a request logger to as complex as the ASP.Net Web API framework.

If you want to get into more details I recommend reading this article.