The Open Web Server Interface for .Net or OWIN for short is a specification that is meant to decouple the dependency a web application has on a specific web server technology. It specifies a simple delegate function that is used to separate a server and application and to let the server know how to pass the responsibility of filling out the response data to the application.
The OWIN specification describes four parts to an application. The host, which is the process the application and server run under. It is responsible for creating the application and the server, retrieving the application delegate function from the application and then passing it to the server so that it can call it to process web requests. The server is responsible for binding to an interface and a port so that clients can start making requests. When a client make a requests it should accept it, fill out the environment dictionary and pass that to the application delegate function so that the application can start processing the request. The middleware is a pipeline of small modular components that act on a request before it reaches the actual application. The final component specified is the Application, this is the end of the pipeline and can be any web application that fills out the response data be it an Web API or MVC site or any other framework.
The delegate function that the server is responsible for calling comes from the application itself. The application delegate is a simple delegate function that accepts a single parameter and returns a task in return so that the server can continue accepting requests and not be blocked by a request being processed. The parameter the application accepts known the environment dictionary is an IDictionary<String, Object> that contains all of the web request details as well as the response details that is supposed to be filled out by the application. This application delegate was specifically designed to use basic .Net data types so that applications that want to support the OWIN standard don’t have to rely on outside DLL’s to do so.
Why should I care about OWIN? Microsoft has started to adopt the OWIN specification into a couple of their projects as well as created projects specifically targeting it. Microsoft release project Katana that Microsoft says is the next step in optimizing your application for the cloud is a set of premade components that adhere to the OWIN specification to make it easier to create OWIN compatible web applications. Microsoft’s vNext team also built support for OWIN style pipeline components directly into vNext. These two projects alone make creating OWIN compatible web applications attractive. With project Katana you can easily create an OWIN compatible application and with vNext you can deploy that application. An added benefit of following the OWIN standard is the portability to different operating systems. Through efforts like Mono is possible to create a server implementation that would run on a Linux machine making it possible to deploy your application on top of it.
ANDREW LALLY | Business Solutions Developer
A 2014 graduate of University of Maryland, Andrew Lally received a B.S. in Computer Science along with a minor in Astronomy. His lack of experience in the corporate world does not translate to experience and knowledge in software development. While attending school full time, Andrew was thrust into many different projects as a KTL part time programmer. This gave him experience broadened his knowledge in many different areas. His experience includes working on projects in which he was to define his own programming language and create a compiler for it; programming a robot navigation algorithm that used only a camera and squares on the ground; Creating a smart task manager application for android and web devices that took into account where you are, what you were previously doing, and your preference on doing certain activities in order to schedule tasks more efficiently. With Andrew’s determination, growing knowledge, and great work ethic, he has become a valuable team player within the KTL development team.