asp.netasp.net-mvciisowinkatana

When should I use OWIN Katana?


I am new to OWIN and Katana. I really don't get why I should use OWIN, while I can use IIS. To simplify, my question is: What do I lose if I skip learning OWIN and use IIS for my websites?

I googled but there is not a simple explanation. There is some information here, but they use some jargon phrases so I cannot understand it.


Solution

  • In asp.net WebApi v2, the OWIN pipeline becomes the default. It is eventually going to be the standard pipeline under any asp.net project.

    I cannot put it better than what is written here : http://www.asp.net/aspnet/overview/owin-and-katana/an-overview-of-project-katana

    The section "The Open Web Interface for .NET (OWIN)" explains perfectly the goals of OWIN.

    Without OWIN, the asp.net bits are coupled to the way IIS communicates with the application. OWIN abstracts web servers and framework components. That means that your application code will now be aware of the OWIN interface, but not of the webserver that is serving the request.

    In return, applications can be more easily ported between hosts and potentially entire platforms/operating systems. For example, the ability to host an application in a console or any process allows Mono to host it without efforts... (Raspberry Pi anyone)

    The second aspect is that it works as a pipeline.


    Owin Pipeline


    You can plug any middlewares (and as many as you want) between the webserver and your application.
    This allows for more modular solutions. You can develop redistributable middlewares that can impact the request/response coming to/from your application, but keep these modules separated from the application code.

    To persuade yourself of the benefits of this modular approach, take a look at the nuget packages available for OWIN : http://www.nuget.org/packages?q=owin

    A lot of these packages were previously core asp.net functionality, and have been extracted as middleware.
    For example, adding support to login using various OAuth providers becomes an infrastructure concern (a middleware) and does not need to be part of your application code anymore :

    Or if you want to automatically replace all the images from your website by cute cat images, you can do that transparently as well :

    https://github.com/serbrech/Owin.Catify

    EDIT : It is now available as a nuget package : Owin.Catify!