Understanding OWIN and Katana

20 August 2021 at 10:00 by ParTech Media - Post a comment

Open-source web stacks are rapidly evolving, thanks to a wide range of features being introduced on a daily basis. Microsoft, on the other hand, is constantly updating its web application stack and has published a slew of new framework components.

Despite the fact that Microsoft's Asp.Net is a mature framework, it lacked some essential properties such as portability, modularity, and scalability that Open Source web stacks provided. This resulted in the creation of OWIN, a definition for how an Asp.Net application and hosting server should be created so that they are independent of one another and need the fewest runtime packages possible.

Asp.Net can become more modular, have higher scalability, and be easily migrated to multiple environments by implementing the OWIN specification, making it competitive with its open-source alternatives. It also aims to encourage participation in the .net open source community for framework and tooling support. So, let us quickly begin with the article.

Table of contents

  1. What is OWIN?
  2. Components of Abstraction
  3. What is Katana?
  4. Why Katana?
  5. Three High-Level Goals of Katana
  6. Conclusion

What is OWIN?

The Open Web Interface (OWIN) for .Net is a community-owned standard that serves as a common interface between.NET online servers and web applications. The purpose of OWIN is to decouple the server and the application, to be an open standard, and to promote the open-source.NET web development tool ecosystem. A delegate structure is used to define OWIN.

Components of abstraction

OWIN was motivated by the gains realized by Rack in the Ruby community, according to the ASP.NET website. Group of.NET developers set out to provide a layer of abstraction between Web servers and framework components. An illustration of the components of abstraction is as follows:

The components of this abstraction include:

  • Server: The HTTP server interfaces directly with the client and then processes requests using OWIN semantics. An adaptor layer that translates to OWIN semantics may be required by servers.
  • Web Framework: On top of OWIN, a self-contained component that exposes its own object model or API that programs can be used to speed up request processing. An adaptor layer that transforms from OWIN semantics may be required by Web Frameworks.
  • Middleware: Components that act as a pipeline between a server and an application, inspecting, routing, or modifying request and response messages for a specific purpose.
  • Host: The process in which an application and server run, and which is primarily responsible for the startup of the application. Some servers also function as hosts. You'll be able to port or migrate your application from one server to another, or port to an entirely different platform and OS, as a result of this abstraction (Host). Let's think about it in terms of the technology that exists on each layer. The diagram would look like this:

The resulting abstraction is made up of two main components. The first is an IDictionary-based environment dictionary. This data structure stores all of the states required to perform an HTTP request and response, as well as any relevant server state. The application delegate is OWIN's second major component. This is the primary interface between all components in an OWIN program, and it is represented by a function signature:

What is Katana?

Katana was created to be a lightweight webserver similar to Node.js, and it offers many of the same features as Node.js and other frameworks. If you know Node.js, you can hop right into Katana because it is influenced by Node.js in nature. Katana is a set of components for creating and hosting web apps that use the Open Web Interface for.NET (OWIN) framework.

Why Katana?

It's crucial to understand the underlying motivations for producing a product, whether it's a developer framework or an end-user product, and that includes knowing who the product was designed for. ASP.NET was designed with two types of users in mind -

Traditional ASP developers: As their size and complexity expanded, conventional ASP applications became difficult to administer. This was largely owing to scripting environments' lack of organization, as well as code duplication caused by code and markup interleaving. ASP.NET took advantage of the code organization offered by the OOP languages of the.NET Framework. At the same time, it also preserved the server-side programming model to which classic ASP developers had grown accustomed to. This helped to capitalize on the strengths of classic ASP while addressing some of its challenges.

Windows business application developers: Unlike traditional ASP developers, who were used to creating HTML markup and the code to generate more HTML markup, WinForms developers (and VB6 developers before them) were used to a design-time experience that included a canvas and a large number of user interface controls. The first version of ASP.NET, also known as "Web Forms," offered a similar design-time experience, as well as a server-side event model for user interface components. It also had a set of infrastructure features (such as ViewState) to provide a seamless developer experience between client and server-side programming. WebnForms used a stateful event architecture to effectively hide the Web's stateless nature.

Three High-Level Goals of Katana

Unlike the OWIN standard and Owin.dll, which are both community-owned and open-source projects, the Katana project represents a set of OWIN components that are produced and delivered by Microsoft. Infrastructure components like hosts and servers are included. Along with it, you also have functional components like authentication components and connectors to frameworks like SignalR and ASP.NET Web API. The project's three high-level objectives are as follows:

  • Portable - As new components become available, components should be able to be quickly swapped out. This goal implies that third-party frameworks can function flawlessly on Microsoft servers, while Microsoft frameworks may be able to run on third-party servers and hosts.
  • Modular/flexible - Unlike many frameworks, which contain a plethora of default capabilities, Katana project components should be modest and focused, providing the application developer flexibility over components to utilize in the application.
  • Lightweight/performant/scalable - Katana applications are lightweight, performant, and scalable because they break down the traditional notion of a framework into a set of small, focused components that are explicitly added by the application developer. As a result, they consume fewer computing resources and can handle more load than other types of servers and frameworks. Since the application's requirements demand new features from the underlying infrastructure, they can be added to the OWIN pipeline, but the application developer must make the decision explicitly.

Conclusion

The Katana project's purpose has never been to create another Web framework and force developers to learn it. Rather, the idea was to design an abstraction that would give.NET Web application developers more options than they had before. The Katana project allows components throughout the stack to improve at whatever rate makes sense for them by splitting out the logical layers of a typical Web application stack into a set of interchangeable components. Katana enables frameworks and the applications built on top of them to be portable across a range of servers and hosts by basing all components on the simple OWIN abstraction.

Latest