SlideShare una empresa de Scribd logo
1 de 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.

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Destacado

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
 

Destacado (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 a 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 a 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?
 

Último

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
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
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
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
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
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
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
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
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
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
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Último (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
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
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
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
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
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
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
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
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
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
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

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.