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

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!

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS