SlideShare a Scribd company logo
1 of 42
Katana & OWIN
A new lightweight Web server for .NET
Simone Chiaretta
@simonech
http://codeclimber.net.nz
Ugo Lattanzi
@imperugo
http://tostring.it
Agenda
 What is OWIN
 OWIN Specs
 Introducing Katana
 Katana pipeline
 Using Katana
 Building OWIN middleware
 A look at the future
What is OWIN
What is OWIN
OWIN defines a standard interface between .NET web
servers and web applications. The goal of the OWIN interface
is to decouple server and application, encourage the
development of simple modules for .NET web development,
and, by being an open standard, stimulate the open source
ecosystem of .NET web development tools.
http://owin.org
What is OWIN
The design of OWIN is inspired by node.js, Rack (Ruby)
and WSGI (Phyton).
In spite of everything there are important differences between
Node and OWIN.
OWIN specification mentions a web server like something that is
running on the server, answer to the http requests and forward
them to our middleware. Differently Node.Js is the web server that
runs under your code, so you have totally the control of it.
IIS and OS
 It is released with the OS
 It means you have to wait the new release of Windows to
have new features (i.e.: WebSockets are available only on
the latest version of Windows)
 There aren’t update for webserver;
 Ask to your sysadmin “I need the latest version of Windows
because of Web Sockets“
System.Web
 I was 23 year old (now I’m 36) when System.Web was born!
 It’s not so cool (in fact it’s missing in all new FW)
 Testing problems
 2.5 MB for a single dll
 Performance
Support OWIN/Katana
Many application frameworks support OWIN/Katana
 Web API
 SignalR
 Nancy
 ServiceStack
 FubuMVC
 Simple.Web
 RavenDB
OWIN specs
OWIN Specs: AppFunc
using AppFunc = Func<
IDictionary<string, object>, // Environment
Task>; // Done
http://owin.org
OWIN Specs: Environment
Some compulsory keys in the dictionary (8 request, 5 response, 2
others)
 owin.RequestBody – Stream
 owin.RequestHeaders - IDictionary<string, string[]>
 owin.Request*
 owin.ResponseBody – Stream
 owin.ResponseHeaders - IDictionary<string, string[]>
 owin.ResponseStatusCode – int
 owin.Response*
 owin.CallCancelled - CancellationToken
OWIN Specs: Layers
• Startup, initialization and process management
Host
• Listens to socket
• Calls the first middleware
Server
• Pass-through components
Middleware
• That’s your code
Application
Introducing Katana aka Fruit Ninja
Why Katana
 ASP.NET made to please ASP Classic (HTTP req/res object
model) and WinForm devs (Event handlers): on fits all
approach, monolithic (2001)
 Web evolves faster then the FW: first OOB release of
ASP.NET MVC (2008)
 Trying to isolate from System.Web and IIS with Web API
(2011)
 OWIN and Katana fits perfectly with the evolution, removing
dependency on IIS
Katana pillars
 It’s Portable
 Components should be able to be easily substituted for new
components as they become available
 This includes all types of components, from the framework to the
server and host
Katana pillars
 It’s Modular/flexible
 Unlike many frameworks which include a myriad of features that
are turned on by default, Katana project components should be
small and focused, giving control over to the application
developer in determining which components to use in her
application.
Katana pillars
 It’s Lightweight/performant/scalable
 Fewer computing resources;
 As the requirements of the application demand more features
from the underlying infrastructure, those can be added to the
OWIN pipeline, but that should be an explicit decision on the part
of the application developer
Katana Pipeline
Katana Pipeline
Host
IIS
OwinHost.exe
Custom Host
Server
System.Web
HttpListener
Middleware
Logger
WebApi
And more
Application
That’s your
code
Using Katana
Hello Katana: Hosting on IIS
Hello Katana: Hosting on IIS
Hello Katana: Hosting on IIS
public void Configuration(IAppBuilder app)
{
app.Use<yourMiddleware>();
app.Run(context =>
{
context.Response.ContentType = "text/plain";
return context.Response.WriteAsync("Hello Paris!");
});
}
Changing Host: OwinHost
Changing Host: OwinHost
Changing Host: Self-Host
Changing Host: Self-Host
static void Main(string[] args)
{
using (WebApp.Start<Startup>("http://localhost:9000"))
{
Console.WriteLine("Press [enter] to quit...");
Console.ReadLine();
}
}
Real World Katana
 Just install the framework of choice and use it as before
Real World Katana: WebAPI
Real World Katana: WebAPI
public void Configuration(IAppBuilder app)
{
HttpConfiguration config = new HttpConfiguration();
config.Routes.MapHttpRoute("default", "api/{controller");
app.UseWebApi(config);
}
Katana Diagnostic
install-package Microsoft.Owin.Diagnostics
Securing Katana
 Can use traditional cookies (Form Authentication)
 CORS
 Twitter
 Facebook
 Google
 Active Directory
OWIN Middleware
OWIN Middleware: IAppBuilder
 Non normative conventions
 Formalizes application startup pipeline
namespace Owin
{
public interface IAppBuilder
{
IDictionary<string, object> Properties { get; }
IAppBuilder Use(object middleware, params object[] args);
object Build(Type returnType);
IAppBuilder New();
}
}
Building Middleware: Inline
app.Use(new Func<AppFunc, AppFunc>(next => (async env =>
{
var response = environment["owin.ResponseBody"] as Stream;
await response.WriteAsync(Encoding.UTF8.GetBytes("Before"),0,6);
await next.Invoke(env);
await response.WriteAsync(Encoding.UTF8.GetBytes(“After"),0,5);
})));
Building Middleware: raw OWIN
using AppFunc = Func<IDictionary<string, object>, Task>;
public class RawOwinMiddleware
{
private AppFunc next;
public RawOwinMiddleware(AppFunc next)
{
this.next = next;
}
public async Task Invoke(IDictionary<string, object> env)
{
var response = env["owin.ResponseBody"] as Stream;
await response.WriteAsync(Encoding.UTF8.GetBytes("Before"),0,6);
await next.Invoke(env);
await response.WriteAsync(Encoding.UTF8.GetBytes(“After"),0,5);
}
}
Building Middleware: Katana way
public class LoggerMiddleware : OwinMiddleware
{
public LoggerMiddleware(OwinMiddleware next) : base(next)
{}
public override async Task Invoke(IOwinContext context)
{
await context.Response.WriteAsync("before");
await Next.Invoke(context);
await context.Response.WriteAsync("after");
}
}
A look at the future
Project K and ASP.NET vNext
 Owin/Katana is the first stone of the new ASP.NET
 Project K where the K is Katana
 Microsoft is rewriting from scratch
 vNext will be fully OSS (https://github.com/aspnet);
 MVC, WEB API and SignalR will be merged (MVC6)
 It uses Roslyn for compilation (build on fly)
 It runs also on *nix, OSx
 Cloud and server-optimized
 POCO Controllers
OWIN Succinctly
Soon available online on
http://www.syncfusion.com/resources/techportal/ebooks
Demo code
https://github.com/imperugo/ncrafts.owin.katana
Merci
Merci pour nous avoir invités à cette magnifique
conférence.

More Related Content

What's hot

Asp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework CoreAsp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework Coremohamed elshafey
 
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»DataArt
 
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideDeveloping Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideMohanraj Thirumoorthy
 
Getting Started with Spring Boot
Getting Started with Spring BootGetting Started with Spring Boot
Getting Started with Spring BootDavid Kiss
 
Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...
Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...
Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...Tin Linn Soe
 
Microservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudEberhard Wolff
 
Introduction to ASP.NET Core
Introduction to ASP.NET CoreIntroduction to ASP.NET Core
Introduction to ASP.NET CoreMiroslav Popovic
 
Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015Ido Flatow
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Matthew Groves
 
Introducing ASP.NET vNext - A tour of the new ASP.NET platform
Introducing ASP.NET vNext - A tour of the new ASP.NET platformIntroducing ASP.NET vNext - A tour of the new ASP.NET platform
Introducing ASP.NET vNext - A tour of the new ASP.NET platformJeffrey T. Fritz
 
Introduction to ASP.NET Core
Introduction to ASP.NET CoreIntroduction to ASP.NET Core
Introduction to ASP.NET CoreAvanade Nederland
 
Building Angular 2.0 applications with TypeScript
Building Angular 2.0 applications with TypeScriptBuilding Angular 2.0 applications with TypeScript
Building Angular 2.0 applications with TypeScriptMSDEVMTL
 
Spring Boot & WebSocket
Spring Boot & WebSocketSpring Boot & WebSocket
Spring Boot & WebSocketMing-Ying Wu
 
Integrating Apache Syncope with Apache CXF
Integrating Apache Syncope with Apache CXFIntegrating Apache Syncope with Apache CXF
Integrating Apache Syncope with Apache CXFcoheigea
 
Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015Strannik_2013
 
Testing Microservices
Testing MicroservicesTesting Microservices
Testing MicroservicesAnil Allewar
 

What's hot (20)

Mini-Training Owin Katana
Mini-Training Owin KatanaMini-Training Owin Katana
Mini-Training Owin Katana
 
Asp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework CoreAsp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework Core
 
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
 
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideDeveloping Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's Guide
 
Technology Radar Talks - NuGet
Technology Radar Talks - NuGetTechnology Radar Talks - NuGet
Technology Radar Talks - NuGet
 
Getting Started with Spring Boot
Getting Started with Spring BootGetting Started with Spring Boot
Getting Started with Spring Boot
 
Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...
Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...
Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...
 
ASP.NET vNext ANUG 20140817
ASP.NET vNext ANUG 20140817ASP.NET vNext ANUG 20140817
ASP.NET vNext ANUG 20140817
 
Microservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring Cloud
 
Introduction to ASP.NET Core
Introduction to ASP.NET CoreIntroduction to ASP.NET Core
Introduction to ASP.NET Core
 
Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015Debugging your Way through .NET with Visual Studio 2015
Debugging your Way through .NET with Visual Studio 2015
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017
 
Introducing ASP.NET vNext - A tour of the new ASP.NET platform
Introducing ASP.NET vNext - A tour of the new ASP.NET platformIntroducing ASP.NET vNext - A tour of the new ASP.NET platform
Introducing ASP.NET vNext - A tour of the new ASP.NET platform
 
Introduction to ASP.NET Core
Introduction to ASP.NET CoreIntroduction to ASP.NET Core
Introduction to ASP.NET Core
 
Building Angular 2.0 applications with TypeScript
Building Angular 2.0 applications with TypeScriptBuilding Angular 2.0 applications with TypeScript
Building Angular 2.0 applications with TypeScript
 
ASP.NET Core 1.0 Overview
ASP.NET Core 1.0 OverviewASP.NET Core 1.0 Overview
ASP.NET Core 1.0 Overview
 
Spring Boot & WebSocket
Spring Boot & WebSocketSpring Boot & WebSocket
Spring Boot & WebSocket
 
Integrating Apache Syncope with Apache CXF
Integrating Apache Syncope with Apache CXFIntegrating Apache Syncope with Apache CXF
Integrating Apache Syncope with Apache CXF
 
Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015Spring Boot. Boot up your development. JEEConf 2015
Spring Boot. Boot up your development. JEEConf 2015
 
Testing Microservices
Testing MicroservicesTesting Microservices
Testing Microservices
 

Viewers also liked

Nodejs for .NET web developers
Nodejs for .NET web developersNodejs for .NET web developers
Nodejs for .NET web developersUgo Lattanzi
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET DevelopersTaswar Bhatti
 
DevIntersections 2014 Web API Slides
DevIntersections 2014 Web API SlidesDevIntersections 2014 Web API Slides
DevIntersections 2014 Web API SlidesBrady Gaster
 
Real World Asp.Net WebApi Applications
Real World Asp.Net WebApi ApplicationsReal World Asp.Net WebApi Applications
Real World Asp.Net WebApi ApplicationsEffie Arditi
 
Micro Services in .NET Core and Docker
Micro Services in .NET Core and DockerMicro Services in .NET Core and Docker
Micro Services in .NET Core and Dockercjmyers
 
How to Make Own Framework built on OWIN
How to Make Own Framework built on OWINHow to Make Own Framework built on OWIN
How to Make Own Framework built on OWINYoshifumi Kawai
 
web apiで遊び倒す
web apiで遊び倒すweb apiで遊び倒す
web apiで遊び倒すKeiichi Daiba
 
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonAdnan Masood
 
Web 2.0 Business Models
Web 2.0 Business ModelsWeb 2.0 Business Models
Web 2.0 Business ModelsTeemu Arina
 

Viewers also liked (10)

Nodejs for .NET web developers
Nodejs for .NET web developersNodejs for .NET web developers
Nodejs for .NET web developers
 
Real-Time Web Applications with ASP.NET WebAPI and SignalR
Real-Time Web Applications with ASP.NET WebAPI and SignalRReal-Time Web Applications with ASP.NET WebAPI and SignalR
Real-Time Web Applications with ASP.NET WebAPI and SignalR
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET Developers
 
DevIntersections 2014 Web API Slides
DevIntersections 2014 Web API SlidesDevIntersections 2014 Web API Slides
DevIntersections 2014 Web API Slides
 
Real World Asp.Net WebApi Applications
Real World Asp.Net WebApi ApplicationsReal World Asp.Net WebApi Applications
Real World Asp.Net WebApi Applications
 
Micro Services in .NET Core and Docker
Micro Services in .NET Core and DockerMicro Services in .NET Core and Docker
Micro Services in .NET Core and Docker
 
How to Make Own Framework built on OWIN
How to Make Own Framework built on OWINHow to Make Own Framework built on OWIN
How to Make Own Framework built on OWIN
 
web apiで遊び倒す
web apiで遊び倒すweb apiで遊び倒す
web apiで遊び倒す
 
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural Comparison
 
Web 2.0 Business Models
Web 2.0 Business ModelsWeb 2.0 Business Models
Web 2.0 Business Models
 

Similar to Owin and Katana

ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0Ido Flatow
 
A Brief History of OWIN
A Brief History of OWINA Brief History of OWIN
A Brief History of OWINRyan Riley
 
Devoxx 2018 - Pivotal and AxonIQ - Quickstart your event driven architecture
Devoxx 2018 -  Pivotal and AxonIQ - Quickstart your event driven architectureDevoxx 2018 -  Pivotal and AxonIQ - Quickstart your event driven architecture
Devoxx 2018 - Pivotal and AxonIQ - Quickstart your event driven architectureBen Wilcock
 
Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0Steven Smith
 
Jax WS JAX RS and Java Web Apps with WSO2 Platform
Jax WS JAX RS and Java Web Apps with WSO2 PlatformJax WS JAX RS and Java Web Apps with WSO2 Platform
Jax WS JAX RS and Java Web Apps with WSO2 PlatformWSO2
 
OWIN Why should i care?
OWIN Why should i care?OWIN Why should i care?
OWIN Why should i care?Terence Kruger
 
Node.js primer for ITE students
Node.js primer for ITE studentsNode.js primer for ITE students
Node.js primer for ITE studentsQuhan Arunasalam
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)slire
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaYevgeniy Brikman
 
Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015Bluegrass Digital
 
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2
 
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)Arrow Consulting & Design
 
Play Support in Cloud Foundry
Play Support in Cloud FoundryPlay Support in Cloud Foundry
Play Support in Cloud Foundryrajdeep
 
O que é esse tal de OWIN?
O que é esse tal de OWIN?O que é esse tal de OWIN?
O que é esse tal de OWIN?Andre Carlucci
 

Similar to Owin and Katana (20)

Node.js Workshop
Node.js WorkshopNode.js Workshop
Node.js Workshop
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
A Brief History of OWIN
A Brief History of OWINA Brief History of OWIN
A Brief History of OWIN
 
Devoxx 2018 - Pivotal and AxonIQ - Quickstart your event driven architecture
Devoxx 2018 -  Pivotal and AxonIQ - Quickstart your event driven architectureDevoxx 2018 -  Pivotal and AxonIQ - Quickstart your event driven architecture
Devoxx 2018 - Pivotal and AxonIQ - Quickstart your event driven architecture
 
Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0
 
Jax WS JAX RS and Java Web Apps with WSO2 Platform
Jax WS JAX RS and Java Web Apps with WSO2 PlatformJax WS JAX RS and Java Web Apps with WSO2 Platform
Jax WS JAX RS and Java Web Apps with WSO2 Platform
 
OWIN Why should i care?
OWIN Why should i care?OWIN Why should i care?
OWIN Why should i care?
 
Owin katana en
Owin katana enOwin katana en
Owin katana en
 
Node.js primer for ITE students
Node.js primer for ITE studentsNode.js primer for ITE students
Node.js primer for ITE students
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
 
Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015
 
Philly Tech Fest Iis
Philly Tech Fest IisPhilly Tech Fest Iis
Philly Tech Fest Iis
 
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
 
WSO2 AppDev platform
WSO2 AppDev platformWSO2 AppDev platform
WSO2 AppDev platform
 
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
 
Play Support in Cloud Foundry
Play Support in Cloud FoundryPlay Support in Cloud Foundry
Play Support in Cloud Foundry
 
Proposal
ProposalProposal
Proposal
 
O que é esse tal de OWIN?
O que é esse tal de OWIN?O que é esse tal de OWIN?
O que é esse tal de OWIN?
 

Recently uploaded

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 

Recently uploaded (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 

Owin and Katana

  • 1. Katana & OWIN A new lightweight Web server for .NET Simone Chiaretta @simonech http://codeclimber.net.nz Ugo Lattanzi @imperugo http://tostring.it
  • 2. Agenda  What is OWIN  OWIN Specs  Introducing Katana  Katana pipeline  Using Katana  Building OWIN middleware  A look at the future
  • 4. What is OWIN OWIN defines a standard interface between .NET web servers and web applications. The goal of the OWIN interface is to decouple server and application, encourage the development of simple modules for .NET web development, and, by being an open standard, stimulate the open source ecosystem of .NET web development tools. http://owin.org
  • 5. What is OWIN The design of OWIN is inspired by node.js, Rack (Ruby) and WSGI (Phyton). In spite of everything there are important differences between Node and OWIN. OWIN specification mentions a web server like something that is running on the server, answer to the http requests and forward them to our middleware. Differently Node.Js is the web server that runs under your code, so you have totally the control of it.
  • 6. IIS and OS  It is released with the OS  It means you have to wait the new release of Windows to have new features (i.e.: WebSockets are available only on the latest version of Windows)  There aren’t update for webserver;  Ask to your sysadmin “I need the latest version of Windows because of Web Sockets“
  • 7. System.Web  I was 23 year old (now I’m 36) when System.Web was born!  It’s not so cool (in fact it’s missing in all new FW)  Testing problems  2.5 MB for a single dll  Performance
  • 8. Support OWIN/Katana Many application frameworks support OWIN/Katana  Web API  SignalR  Nancy  ServiceStack  FubuMVC  Simple.Web  RavenDB
  • 10. OWIN Specs: AppFunc using AppFunc = Func< IDictionary<string, object>, // Environment Task>; // Done http://owin.org
  • 11. OWIN Specs: Environment Some compulsory keys in the dictionary (8 request, 5 response, 2 others)  owin.RequestBody – Stream  owin.RequestHeaders - IDictionary<string, string[]>  owin.Request*  owin.ResponseBody – Stream  owin.ResponseHeaders - IDictionary<string, string[]>  owin.ResponseStatusCode – int  owin.Response*  owin.CallCancelled - CancellationToken
  • 12. OWIN Specs: Layers • Startup, initialization and process management Host • Listens to socket • Calls the first middleware Server • Pass-through components Middleware • That’s your code Application
  • 13. Introducing Katana aka Fruit Ninja
  • 14. Why Katana  ASP.NET made to please ASP Classic (HTTP req/res object model) and WinForm devs (Event handlers): on fits all approach, monolithic (2001)  Web evolves faster then the FW: first OOB release of ASP.NET MVC (2008)  Trying to isolate from System.Web and IIS with Web API (2011)  OWIN and Katana fits perfectly with the evolution, removing dependency on IIS
  • 15. Katana pillars  It’s Portable  Components should be able to be easily substituted for new components as they become available  This includes all types of components, from the framework to the server and host
  • 16. Katana pillars  It’s Modular/flexible  Unlike many frameworks which include a myriad of features that are turned on by default, Katana project components should be small and focused, giving control over to the application developer in determining which components to use in her application.
  • 17. Katana pillars  It’s Lightweight/performant/scalable  Fewer computing resources;  As the requirements of the application demand more features from the underlying infrastructure, those can be added to the OWIN pipeline, but that should be an explicit decision on the part of the application developer
  • 23. Hello Katana: Hosting on IIS public void Configuration(IAppBuilder app) { app.Use<yourMiddleware>(); app.Run(context => { context.Response.ContentType = "text/plain"; return context.Response.WriteAsync("Hello Paris!"); }); }
  • 27. Changing Host: Self-Host static void Main(string[] args) { using (WebApp.Start<Startup>("http://localhost:9000")) { Console.WriteLine("Press [enter] to quit..."); Console.ReadLine(); } }
  • 28. Real World Katana  Just install the framework of choice and use it as before
  • 30. Real World Katana: WebAPI public void Configuration(IAppBuilder app) { HttpConfiguration config = new HttpConfiguration(); config.Routes.MapHttpRoute("default", "api/{controller"); app.UseWebApi(config); }
  • 32. Securing Katana  Can use traditional cookies (Form Authentication)  CORS  Twitter  Facebook  Google  Active Directory
  • 34. OWIN Middleware: IAppBuilder  Non normative conventions  Formalizes application startup pipeline namespace Owin { public interface IAppBuilder { IDictionary<string, object> Properties { get; } IAppBuilder Use(object middleware, params object[] args); object Build(Type returnType); IAppBuilder New(); } }
  • 35. Building Middleware: Inline app.Use(new Func<AppFunc, AppFunc>(next => (async env => { var response = environment["owin.ResponseBody"] as Stream; await response.WriteAsync(Encoding.UTF8.GetBytes("Before"),0,6); await next.Invoke(env); await response.WriteAsync(Encoding.UTF8.GetBytes(“After"),0,5); })));
  • 36. Building Middleware: raw OWIN using AppFunc = Func<IDictionary<string, object>, Task>; public class RawOwinMiddleware { private AppFunc next; public RawOwinMiddleware(AppFunc next) { this.next = next; } public async Task Invoke(IDictionary<string, object> env) { var response = env["owin.ResponseBody"] as Stream; await response.WriteAsync(Encoding.UTF8.GetBytes("Before"),0,6); await next.Invoke(env); await response.WriteAsync(Encoding.UTF8.GetBytes(“After"),0,5); } }
  • 37. Building Middleware: Katana way public class LoggerMiddleware : OwinMiddleware { public LoggerMiddleware(OwinMiddleware next) : base(next) {} public override async Task Invoke(IOwinContext context) { await context.Response.WriteAsync("before"); await Next.Invoke(context); await context.Response.WriteAsync("after"); } }
  • 38. A look at the future
  • 39. Project K and ASP.NET vNext  Owin/Katana is the first stone of the new ASP.NET  Project K where the K is Katana  Microsoft is rewriting from scratch  vNext will be fully OSS (https://github.com/aspnet);  MVC, WEB API and SignalR will be merged (MVC6)  It uses Roslyn for compilation (build on fly)  It runs also on *nix, OSx  Cloud and server-optimized  POCO Controllers
  • 40. OWIN Succinctly Soon available online on http://www.syncfusion.com/resources/techportal/ebooks
  • 42. Merci Merci pour nous avoir invités à cette magnifique conférence.