SlideShare une entreprise Scribd logo
1  sur  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.

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

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
 

En vedette (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
 

Similaire à 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
 

Similaire à 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?
 

Dernier

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Dernier (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

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.