I have talked @ in earlier blogs @ OWIN and Katana in summary
OWIN defines a standard interface between .NET web servers and web applications. The goal of the OWIN interface is to decouple server and application, encourage the development of simple modules for .NET web development, and, by being an open standard, stimulate the open source ecosystem of .NET web development tools.
Katana – OWIN implementations for Microsoft servers and frameworks
Therefore we hear these 2 words (OWIN / KATANA) together and many times we get confused between the difference between these 2 terms. So, Katana is Microsoft’s implementation of OWIN interface. Say there is another company named AppleGoogleIBM who wanted to create their own implementation of OWIN, they can do that and name their implementation as ‘XYZ’ and advertise phrases like OWIN/XYZ
So, why OWIN !!!
Think about a country where the only vehicle available for movement is a truck. Nothing else. If you want to buy a vehicle, you would buy truck. Well, that used to serve good but people started to realize that, they don’t need truck all the time, specially when they want to go to watch a movie or buy milk, driving a heavy truck not only costs high fuel, but also add stress on driving. But yes, if they want to carry lots of heavy stuffs, truck serves the purpose very well.
Then, the Government of that country came up with a specification for vehicle makers. The specification is as follows:
- A vehicle needs to have 4 wheels
- A vehicle must have a steering.
- A vehicle must have headlight and signal lights.
So, based on these specifications, anyone can make vehicle according to different needs and they can name their vehicle accordingly. Therefore, Sedan, Pickup Truck, SUV, VAN, ..etc.. all kind of vehicle showed up in the market. If someone does not need to carry heavy stuffs all the time, rather needs a vehicle just for going to workplace, he/she can buy a little Sedan. Someone can buy SUV if he needs little more power.
Based on the above example, we can say that our ASP.NET Web application uses System.Web Assembly which is heavily loaded (like a truck) and if we want to make a little Web Application where our purpose is just to serve some files based on a little set of requests, we are bound to use that heavy System.Web assembly (truck). Now, OWIN shows up. OWIN is a set of specification (we can call it interface) that defines a Server. Based on that specification, someone (like a vehicle maker) can make various kind of servers based on specific problem domains / application needs. Microsoft created their own Implementation for OWIN named Katana in the same way which can serve Web API. As WebAPI is a light weight technology, which does not need full blown System.Web things, a light weight Server implementation (like Katana) can boost the performance heavily when you use Web Api hosted on Katana.
Now, if you ask, ‘Do I need it‘ ? Answer is, ‘It depends on your need of performance’. If you dont mind driving your truck even for going to watch a movie, then, perhaps you do not need OWIN. But if you feel that, a light weight Sedan car is all you need to drive within a city, small distance, watch movie..etc.. yes, You may check what implementations of OWIN available in the market. Katana is one of the implementation of OWIN, therefore you can check what Katana offers. Not only Katana, if any other company implements OWIN according to specific Domain (for example, a server for Medical Devices which will download latest medicine information) and if you are a doctor, perhaps, you can check that implementation of OWIN. Moreover, you yourself can create your own implementation of OWIN targeting any specific niche.
When I may need to write my own OWIN Implementation ?
You have developed an Windows application which should run as a server in the background and listen to a port number XXXX. Your server will respond to only some set of Requests like this:
- GET Inventory
- DELETE Inventory ID=4
- PUT Inventory ID=5
Thats all. And nothing else. So, why would you need a full IIS web server for this little task ? You can create your own OWIN implementation in that case. (Perhaps, you will use Katana for that).