When should I use OWIN Katana?

When should I use OWIN Katana?

解答1

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!  

 

 

 

 解答2

A simpler version of that answer is that Katana is gong to fully replace System.Web assembly and the old ASP.NET pipeline, which gives you both better flexibility (use it in more scenarios and use only the parts you like) and performance.

So everyone should watch its evolution now and be ready to switch when it is finally completed.

Below is a diagram I drew to fill in the details Microsoft fails to include in this article.

enter image description here

OWIN is such a standard that it let application frameworks run upon it and forget about everything beneath it. On the other hand, OWIN itself utilizes various host adapters to make sure it can talk to the underlying web servers (IIS and many others).

I am now working with the Jexus web server author to investigate how we can write a host adapter to bridge OWIN/Katana and Jexus. We are really happy to learn that OWIN is flexible and highly customizable.

Reference: http://blog.lextudio.com/2014/06/why-owin-matters-a-lot-for-asp-net-developers/

 

 

 

 

 

 

 

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(256)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2017-02-28 Import Example Dataset
2017-02-28 Introduction to MongoDB
2017-02-28 Getting Started with MongoDB (C# Edition)
2017-02-28 本地搭建MongoDB Server
点击右上角即可分享
微信分享提示