Easy to Develop a Simple Application Using OWIN
OWIN stands for The Open Web Interface for .NET. It is a standard for communication between .NET web servers and web applications. It defines required elements for HTTP request (details). We can say that it is a lightweight web server for .NET.
As OWIN is becoming popular and more common, it is important for ASP.NET developers to understand what OWIN and Katana are. ASP.NET Web API and ASP.NET Identity are already geared towards using these specifications. To that end this article explains what OWIN and Katana are and how they fit into the whole web development picture for ASP.NET developers. You will also develop a simple application to get a code level understanding of these features.
What is OWIN?
OWIN stands for Open Web Interface for .NET. OWIN is a specification that describes how web development frameworks such as ASP.NET MVC should interact with the web servers. The goal of OWIN is to decouple web applications from the web server by introducing an abstraction layer. Such an abstraction enables you to run the same application on all the web servers that support OWIN. Additionally, it simplifies the overall system because the abstraction layer can provide a lightweight infrastructure to host the applications. IIS provides a rich set of features to the web applications. However, web applications may not need all these features. It might be sufficient for them to have minimal HTTP processing capabilities. OWIN compatible host can provide such a hosting environment to these applications. Moreover, you can define a pipeline of modules that are used during the request processing. An OWIN pipeline is a chain of OWIN compatible components through which a request passes.
The OWIN specification is a community initiative and more details can be found at the owin.org website.
What is Katana?
Katana is a set of components by Microsoft built using OWIN specifications. Some of these components include Web API, ASP.NET Identity and SignalR.
Developing a Simple Application Using OWIN
First, we need to create application project. Let’s create ‘Empty Web Application’ (it might be also Console App).
Next, we will install two NuGet packages (using Package Manager Console):
Install-Package Microsoft.Owin.Host.SystemWeb
Install-Package Owin.Extensions
Then, we need to create ‘Startup class’.
using System; using System.Collections.Generic; using System.Linq; using System.Web; using Owin; namespace OwinDemo { public class Startup { public void Configuration(IAppBuilder app) { app.UseHandlerAsync((req, res) => { res.ContentType = "text/plain"; return res.WriteAsync("OWIN and Katana ASP.NET Hosting!"); }); } } }
You need to modify Web.config file, adding following code in configuration section:
Then you can run server (CTRL+F5) and you should see:
<appSettings> <add key="owin:HandleAllRequests" value="true"/> </appSettings>
Then you can run server (CTRL+F5) and you should see:
OWIN and Katana ASP.NET Hosting!
Our Cheap OWIN and Katana ASP.NET Hosting Recommendation
ASPHostPortal.com OWIN and Katana ASP.NET Hosting infrastructure features independent email, web, database, DNS and control panel servers and lightning fast servers ensuring your site loads super quick! Reason why you should choose them to host your OWIN and Katana site:
[stextbox id=”asp_net_hosting” caption=”ASPHostPortal.com is Microsoft No #1 Recommended Windows Hosting Partner”]ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. Microsoft presents this award to ASPHostPortal.com for the ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2012, .NET 4.5.2/ASP.NET 4.5.1, ASP.NET MVC 6.0/5.2, Silverlight 5 and Visual Studio Lightswitch. Click here for more information[/stextbox]
Best Programming Support – ASPHostPortal.com hosting servers come ready with the latest ASP.NET version. You can get access directly to your MSSQL from their world class Plesk Control Panel.
Best Server Technology – The minimal specs of their servers includes Intel Xeon Dual Core Processor, RAID-10 protected hard disk space with minimum 8 GB RAM. You dont need to worry about the speed of your site.
Best and Friendly Support – Their customer support will help you 24 hours a day, 7 days a week and 365 days a year to assist you.
Uptime & Support Guarantees – They are so confident in their hosting services they will not only provide you with a 30 days money back guarantee, but also they give you a 99.9% uptime guarantee.
World Class Control Panel – They use World Class Plesk Control Panel that support one-click installation.