Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


OWIN: The Changing Face of Web Development in the Microsoft World

Learn how the Open Web Interface for .NET (OWIN) can help solve some performance challenges and provide greater control in porting and hosting applications between different platforms.


The Open Web Interface for .NET (OWIN) is a specification created out of the efforts from the .NET community to build an abstraction between web servers and the .NET framework. ASP.NET until .NET 4.0 was extremely monolithic with a series of pipeline components tightly coupled with IIS. Whether you need them or not, there is no way you could get rid of them and you had to pay for the cost in performance with every request.

The project, code named Katana, and OWIN attempts to solve some of the performance changes with System.web.dll and gives you greater control in porting and hosting applications between different platforms and also makes it very easy to develop and extend.

The number of dependencies that you need to write an OWIN compatible web application is greatly reduced as compared to traditional ASP.NET. When you create an OWIN project you will automatically see the difference.

Note that OWIN components are owned by the community, however project Katana is run by Microsoft (hence the credibility). The OWIN components are part of Owin.dll and are available as a nuget package.

It is very easy to start with OWIN. You can create an empty Web Application project and add the OWIN nuget package using the following command:

 install-package Microsoft.Owin.Host.SystemWeb 

Once you have successfully installed, you can host the OWIN server in IIS using the IAppBuilder interface. Create a class named "Startup" (it is important to name it this way for OWIN discovery) and add the following code to create the host:

 public void Configuration(IAppBuilder app)
            app.Run(context =>
                context.Response.ContentType = "text/html";
                return context.Response.WriteAsync("OWIN Started!");

You can now run the application just like any other ASP.NET application and you will notice OWIN running. Note that in this case, OWIN is running in the ASP.NET pipeline, however it is not difficult to switch to a different host.

To create a console host, install the nuget package OwinHost using the command:

 Install-package OwinHost 

You can now launch the OwinHost.exe from the installed packages folder. Make sure to run it from the project root to allow the host to search for an OwinStartupAttribute assembly. You are now all set to run OWIN from a console host. You will see the same output as earlier, just that it is no longer using the ASP.NET pipeline. This is very powerful. In a future post we will explore some very interesting capabilities that the Katana project is throwing at us!

Sandeep Chanda is a Director of Solutions at Neudesic, a Microsoft National Systems Integrator and Gold Certified Partner. He has been working on several Microsoft Technologies (including but not limited to .NET, Azure, BizTalk, SharePoint and Dynamics CRM) for the past ten years, building large scale enterprise applications spanning multiple industries. He is a technology enthusiast and a speaker at various corporate events and public webinars. He has authored several articles on Microsoft Dynamics CRM 4.0 in DevX, and is the Author of the books Windows Identity Foundation Cookbook by PacktPub, and Beginning ASP.NET 4.5 Databases by Apress. Most recently he has been involved in evangelizing aspects of Application Lifecycle Management (ALM) and developer collaboration using Team Foundation Server 2012 and was the speaker on the subject at the Great Indian Developer Summit 2012. He is currently co-authoring a book on Dynamics CRM Marketing Automation with PacktPub. Sandeep holds an MS degree in Software Systems from BITS, Pilani and his areas of interest include Service Oriented Computing, Cross Platform Mobility, Pervasive Computing, Haptic Devices and Cloud Computing.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date