Getting Started With OWIN

What is OWIN

This article is on getting started with OWIN i.e. Open Web Interface for .Net. It is basically a specification that mentions how to write middleware that connects 2 different platforms. You can think of it as a pipleline which sits in between 2 components, essentially making both of them decoupled. The next article writing Writing Your First OWIN Based Application will demonstrate a working example.


Why Do We Need OWIN

But the question arises that why do we need OWIN at all. You might remember that ASP.Net as a framework has a dependency on IIS (Internet Information Services) as a hosting platform. This means that if you want to deploy / host any web-site built in ASP.Net then you would have to host it in IIS. What is essentially means is that the only web server available for your web application is IIS. Also it had a heavy reliance on the System.Web.dll assembly. With the advent of the modern frameworks like NodeJS etc. we now have multiple choices of hosting our web content. Take the example of NodeJS, you can get a webserver up an running with just a few lines of code. Since Microsoft is also now encouraging open-source community based projects, it came up with the idea of OWIN. Hence OWIN is a collaboration, community-based project.

As I mentioned earlier, OWIN is not any technology, it is just a way of writing some code which will connect a server and an application. You can get more details on OWIN at As per this specification the official definition is “OWIN defines a standard interface between .NET web servers and web applications. Its goal is to add decoupling between the application and server.”

An important thing to note that this is entirely for the .Net framework based components, servers and applications.

How Does OWIN Work

As per its documentation, a server can invoke an application providing an environment dictionary as arguments with request and response header/body. The main interface in OWIN is called the application delegate or AppFunc. An application delegate takes the IDictionary<string, object> environment and returns a Task when it has completed with the processing. Below is its signature

Func<IDictionary<string, object>, Task>; //Input the environment dictionary and return Task

The application delegate is simply an implementation of the Func delegate type where the function accepts the environment dictionary as input and returns a Task.

OWIN and Katana

Now instead of explaining the above code, I will jump straight to Katana. Why, you will ask. This is because the OWIN specification in itself is hard to understand. Hence a set of wrappers were written which internally call the OWIN specification for us. One such wrapper implementation is the Katana project. You can get more info on it at The Katana component suite gives a developer the ability to host applications in their own custom process, whether that is a console application, Windows service, etc.

Regarding how to use the above OWIN code, read my next article ‘Writing Your First OWIN Based Application’, where we will see a small step-by-step demo using the OWIN wrapper code provided by Katana.


OWIN is a middleware which tends to mimic the pipeline architecture of web servers like IIS. But OWIN has much more features which allow plug and play kind of functionality unlike IIS where the pipeline architecture is mostly fixed. Our next article Writing Your First OWIN Based Application will help us writing a practical example hence make sure you check this out.

Hitesh Boricha

I have a little over a decade experience in the IT industry. Having worked in various roles in this industry, I am passionate about technology.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.