OWIN and Katana

  Introduction

Katana is a new webframework that appearing with visual studio 2013. Katana is based on the specification named OWIN. If you started a ASP.NET MVC5  application by using a project template in visual studio you can see some pieces of information related to Katana.
Imagine you are started to develop a new web framework like ASP.NET MVC, How can you interact with the webserver? that is the process is cordinate with OS to listen for Http Request on a socket.How does the software can interact with the host?
We already know ASP.NET is built on the top of Internet Information Services(IIS).The ASP.NET runtime and IIS provide a wonderful collection of features such as Caching,Authentication,Compression,Encryption and some other features like diagnostics which include logging,Request monitoring and others. Not everyone need this features.
In last few years we can see that some architectural changes in the web development.Html5 standards become popular and more processing happens in the client side.Instead of processing heavy operation in the server side for generating html,server is only responsible for handling Ajax request and sending back all data for processing it in the client side.This are the processes happens during mobile application development.

Goal of KATANA

Some people are looking a fast,xtensible framework for developing web application ike Node js. Node is not a webserver itself but easy to add a package or a single library for making a webserver, the webserver exactly has the same features for building a web application nothing more.So the server become and easy to scale.That is the goal of KATANA,provide a light weight piece of software you can use Web applications,websites and web Apis.In ASP.NET MVC everything we needed for web in the system.web assembly, The KATANA is highly modularized we can use whatever the features we want.

Demo

First i am going to create a console application and then process and listen http request using OWIN and KATANA.

1

Step1: Inorder to do that first we need to install some nuget packages.Go to package manager console and install two packages such as Microsoft.Owin.Hosting and Microsoft.Owin.Host.HttpListener.
Package 1 : 
2
Package 2 : 
3

these packages will  add four dependencies in your application

4

 

 

 

 

 

Step2 : Configure KATANA
for configuring this application we need to add a StartUp class contains a method named Configuration which accept a parameter of type IAppBuilder interface. This interface is very important because it includes some methods that allow you to configure how this application is going to behave and respond HttpRequests
5
Step3 : Start the webserver in the entry point of the main method like below and run the application.

6

7

Step 3 : Browse the url we had provide as a URI in the start up

8

Enjoy..coding…