SlideShare uma empresa Scribd logo
1 de 66
0
A Brief History of
OWIN
Ryan Riley
Welcome to Houston TechFest
• Please turn off all electronic devices or set them to vibrate.
• If you must take a phone call, please do so in the lobby so as not
to disturb others.
• Thanks to our Diamond Sponsors:
Thank you for being a part of the
9th Annual Houston TechFest!
2
Please Leave Feedback During Q&A
If you leave session
feedback and provide
contact information in
the survey, you will be
qualified for a prize
Scan the QR Code to
the right or go to
http://bit.ly/1K1Hvi5
3
Ryan Riley
• Engineer at Tachyus
• OWIN Management Committee
• ASPInsider
• Visual F# MVP
• Leads Community for F#
4
Click to edit Master title style
Why OWIN?
Open Web Interface for .NET
5
Click to edit Master title style
Problem: Desire for Fast and
Light-weight Frameworks and
Servers
ASP.NET was “too heavy”
IIS was “too slow”
ASP.NET was coupled to IIS
Hard to do REST
6
Solutions
• Boat
• Figment
• Fracture
• Frank
• FubuMVC
• KayakHTTP
• NancyFx
• Nina
• NRack
• OpenRasta
• Suave
• WCF Web API (later ASP.NET Web API)
• Among others
7
Click to edit Master title style
Problem: Repetition
Sinatra in .NET
ASP.NET adapters
Self-host adapters (esp. HttpListener)
8
Solution: Collaborate
http://despair.com/products/collaboration
9
September 7, 2010
I’ve noticed a trend recently in projects each of us has worked/is
working on and wondered if we might be willing to pool our
resources.... If you are interested in working together, please let me
know.... I’m sure we could agree on a common platform for our efforts.
- Email from Ryan Riley (Frank) to
Benjamin van der Veen (KayakHTTP),
Mauricio Scheffer (Figment), and
Scott Koon (Boat)
10
September 27, 2010
Benjamin van der Veen submits first draft of interfaces
public interface IHttpResponder {
IObservable<IHttpServerResponse> Respond(
IHttpServerRequest request,
IDictionary<string, object> context
);
}
public interface IHttpServerRequest {
HttpRequestLine RequestLine { get; }
IDictionary<string, string> Headers { get; }
IObservable<ArraySegment<byte>> GetBodyChunk();
}
public interface IHttpServerResponse {
HttpStatusLine StatusLine { get; }
IDictionary<string, string> Headers { get; }
string BodyFile { get; }
IObservable<ArraySegment<byte>> GetBodyChunk();
}
11
November 29, 2010
Scott Koon creates .NET HTTP Abstractions
• Now called OWIN Working Group
• https://groups.google.com/forum/#!forum/
net-http-abstractions
12
Click to edit Master title style
Problem: Opinions and Existing
Implementations
13
Solution: Define a Common Interface
• Rack (Ruby)
• WSGI (Python)
14
Consensus to share server wrappers
15
Progress!
• Name: Open Web Interface for .NET (OWIN)
• Began writing specification
• BHAG: run ASP.NET MVC on top
16
Click to edit Master title style
Problem: Trouble in Paradise
17
Solutions
Factions
• Which interfaces / types?
• Require a library dependency?
• OOP vs FP
• Static vs Dynamic typing
Solutions
• Only types from the FCL
• No library dependency
• Delegates +
• IDictionary<string, object>
18
Click to edit Master title style
Problem: How to represent async
access to the message body?
19
Proposed Solution #1: System.IO.Stream
• Considered “too heavy” as an interface
• Async access considered “too slow” due to APM model
• Rejected
20
Proposed Solution #2: System.IObservable<T>
• Concerned about back-pressure
• Required library dependency for .NET 3.5
• Rejected
21
Proposed Solution #3: Task
• Required (then new) .NET 4.0
• Some contributors had an established .NET 3.5 user base
• Rejected
22
Proposed Solution #4: “Delegate of Doom”
public delegate void AppDelegate(
IDictionary<string, object> env,
ResultDelegate result,
Action<Exception> fault);
public delegate void ResultDelegate(
string status,
IDictionary<string, IEnumerable<string>> headers,
BodyDelegate body);
public delegate void BodyDelegate(
Func<ArraySegment<byte>, bool> write,
Func<Action, bool> flush,
Action<Exception> end,
CancellationToken cancellationToken);
• Accepted!
23
Click to edit Master title style
Problem: “Delegate of Doom”
difficult to implement
24
Solution: Gate reference / helper library
Image from “The Reality of a Developer's Life - in GIFs, Of Course”
25
Click to edit Master title style
WIN: SignalR chooses OWIN!
26
Click to edit Master title style
Problem: SignalR not compatible
with “Delegate of Doom”
27
Single Tap
• SignalR
• ASP.NET
• Fubu MVC
• Razor
• node.js
28
Double Tap
• OWIN (with “Delegate of Doom”)
• ASP.NET Web API
• Frank
• NancyFX
• Rack (Ruby)
29
Solution
using Environment = IDictionary<string, object>
using AppFunc = Func<Environment, Task>
30
Task?
• Accepted on August 22, 2012
• 2 years makes a big difference
31
The OWIN Specification
http://owin.org/html/owin.html
1. Overview
2. Definitions
3. Request Execution
3.1. Application Delegate
3.2. Environment
3.3. Headers
3.4. Request Body
3.5. Response Body
3.6. Request Lifetime
4. Application Startup
5. URI Reconstruction
5.1. URI Scheme
5.2. Hostname
5.3. Paths
5.4. URI Reconstruction Algorithm
5.5. Percent-encoding
6. Error Handling
6.1. Application Errors
6.2. Server Errors
7. Versioning
32
Request Keys
• owin.RequestBody : Stream
• owin.RequestHeaders : IDictionary<string, string[]>
• owin.RequestMethod : string
• owin.RequestPath : string
• owin.RequestPathBase : string
• owin.RequestProtocol : string
• owin.RequestQueryString : string
• owin.RequestScheme : string
• owin.RequestId* : optional string
• owin.RequestUser* : optional ClaimsPrincipal
33
Response Keys
• owin.ResponseBody : Stream
• owin.ResponseHeaders : IDictionary<string, string[]>
• owin.ResponseStatusCode : optional int (default is 200)
• owin.ResponseReasonPhrase : optional string (default set by server)
• owin.ResponseProtocol : optional string
34
Other Data
• owin.CallCancelled : CancellationToken
• owin.Version : string
35
Using AppFunc
using System.IO;
using System.Text;
using Headers = IDictionary<string, string[]>;
var app = AppFunc(env =>
{
var bytes = Encoding.UTF8.GetBytes("Hello, OWIN!");
var length = bytes.Length.ToString();
var headers = (Headers)env.["owin.ResponseHeaders"];
headers.Add("Content-Type", new[] { "text/plain" });
headers.Add("Content-Length", new[] { length });
var stream = (Stream)env.["owin.ResponseBody"];
return stream.WriteAsync(bytes, 0, bytes.Length);
});
36
Flexibility: AppFunc as a Class
public class MyApp
{
public Task Invoke(Environment env)
{
var bytes = Encoding.UTF8.GetBytes("Hello, OWIN!");
var length = bytes.Length.ToString();
var headers = (Headers)env.["owin.ResponseHeaders"];
headers.Add("Content-Type", new[] { "text/plain" });
headers.Add("Content-Length", new[] { length });
var stream = (Stream)env.["owin.ResponseBody"];
return stream.WriteAsync(bytes, 0, bytes.Length);
}
}
37
Flexibility: AppFunc as a Method
public class MyApps
{
public Task MyApp1(Environment env)
{
// uses state from MyApps
}
public static Task MyApp2(Environment env)
{
// does not use MyApps’ state
}
}
38
AppFunc Composition
public static class Logging
{
public static Task LogBefore(Environment env) { /**/ }
public static Task LogAfter(Environment env) { /**/ }
public static ???? Log(????)
{
LogBefore(env);
// call something else, but how?
LogAfter(env);
}
}
39
Middleware
using MidFunc = Func<AppFunc, AppFunc>;
public static class Logging
{
public static Task LogBefore(Environment env) { /**/ }
public static Task LogAfter(Environment env) { /**/ }
public static AppFunc Log(AppFunc next)
{
return async env => {
LogBefore(env);
await next(env);
LogAfter(env);
};
}
}
40
Middleware as a Class
public class Logging
{
AppFunc next;
public Logging(AppFunc next)
{
this.next = next;
}
static Task LogBefore(Environment env) { /**/ }
static Task LogAfter(Environment env) { /**/ }
public async Task Invoke(Environment env)
{
LogBefore(env);
await this.next(env);
LogAfter(env);
}
}
41
OO AppFunc Composition
public class Startup
{
private readonly AppFunc composed;
public Startup(AppFunc next)
{
this.composed = Logging.Log(next);
}
public Task Invoke(Environment env)
{
return this.composed(env);
}
}
42
Functional AppFunc Composition
public static class Startup
{
static readonly AppFunc next = ...;
static readonly AppFunc composed = Logging.Log(next);
public static Task Invoke(Environment env)
{
return Startup.composed(env);
}
}
43
Goals Achieved
No dependencies
Flexibility of style
Server independence
44
Bonus!
Simple composition
Can construct dynamic execution graphs*
No server required (easy to unit test)
45
Click to edit Master title style
Push to 1.0
46
Microsoft and others adopt OWIN
• Microsoft.Owin, a.k.a. Katana
• Fix
• Freya
• SimpleOwin
• Simple.Owin
• Suave
• WebSharper
47
Server Support
• System.Web
• HttpListener
• IIS (Helios)
• Nowin (cross-platform)
• Suave (cross-platform)
48
Middleware
• CORS
• Security
• Routing (Superscribe)
• Diagnostics
• Many more!
49
Put It All Together
// Using Microsoft.Owin
public class Startup {
public void Configuration(IAppBuilder app) {
app.Properties["host.AppName"] = "composed app";
app.UseCors(Cors.CorsOptions.AllowAll)
.MapSignalR()
.UseWebApi(new HttpConfiguration())
.UseNancy();
}
}
50
Artifact: owin.dll
• Originally intended to provide the delegate signatures
• IAppBuilder was later added and left as the only interface
• IAppBuilder was not spec’d and had no connection to AppFunc
public interface IAppBuilder
{
IDictionary<string, object> Properties { get; }
IAppBuilder Use(object middleware, params object[] args);
object Build(Type returnType);
IAppBuilder New();
}
51
Click to edit Master title style
Moving Forward
52
OWIN Management Committee
• Established governance model
• Converted specs to Markdown (https://github.com/owin/owin)
• GitHub Issues to submit and vote on changes
(https://github.com/owin/owin/issues)
53
Formalized Middleware Signature
• Specification in draft
using MidFunc = Func<AppFunc, AppFunc>
using MidFactory =
Func<
IDictionary<string, object>, // startup properties
MidFunc // outer Middleware
>
using BuildFunc = Action<MidFactory>
54
BHAG: ASP.NET vNext and MVC 6
• Achievement unlocked …
• … sort of
55
Two Steps Back (Step 1)
https://twitter.com/jchannon/status/641312171918553088
56
ASP.NET 5 and DNX Support
public void Configure(IApplicationBuilder app)
{
app.UseCookieAuthentication(options => {
options.AutomaticAuthentication = true;
options.AuthenticationScheme =
CookieAuthenticationDefaults.AuthenticationScheme;
});
app.UseTwitterAuthentication(configureOptions => {
configureOptions.ConsumerKey = TWITTERCONSUMERKEY;
configureOptions.ConsumerSecret = TWITTERSECRET;
});
app.UseOwin(x => x.UseNancy());
}
57
Two Steps Back (Step 2)
Different opinions about:
• Discovery, i.e. IAppBuilder
• Middleware
58
Katana-style Middleware
• “Soft 404”
• Linear pipeline set at compile time
• Possible to branch using IAppBuilder.Map
59
Dynamic Pipeline
• Techniques used by Damian Hickey and Sebastian Lambla
• Middleware builds and executes its own pipeline
• Can change during runtime
• See an example
60
Graph-based Execution
• Superscribe – routing
• Freya – web machine
61
Verdict: Middleware Wins
• Still more ideas to try out!
• What are yours?
62
Questions?
63
Get Involved!
• Submit your feedback on the specs
• Help us with governance
• Propose and vote on next steps
• http://owin.org/
• https://github.com/owin/owin/issues
• http://groups.google.com/group/net-http-abstractions
Please Leave Feedback During Q&A
If you leave session
feedback and provide
contact information in
the survey, you will be
qualified for a prize
Scan the QR Code to
the right or go to
http://bit.ly/1K1Hvi5
Thanks to all our Sponsors!

Mais conteĂşdo relacionado

Mais procurados

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
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introductionSimon Funk
 
Introduction to Laravel
Introduction to LaravelIntroduction to Laravel
Introduction to LaravelEli Wheaton
 
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...Etiene Dalcol
 
Laravel Webcon 2015
Laravel Webcon 2015Laravel Webcon 2015
Laravel Webcon 2015Tim Bracken
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkFabio Tiriticco
 
DanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino APIDanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino APIPaul Withers
 
ASP.NET vNext ANUG 20140817
ASP.NET vNext ANUG 20140817ASP.NET vNext ANUG 20140817
ASP.NET vNext ANUG 20140817Christian Horsdal
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.jsPrabin Silwal
 
A introduction to Laravel framework
A introduction to Laravel frameworkA introduction to Laravel framework
A introduction to Laravel frameworkPhu Luong Trong
 
Alfresco 5.2 REST API
Alfresco 5.2 REST APIAlfresco 5.2 REST API
Alfresco 5.2 REST APIJ V
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0Ido Flatow
 
OpenNTF Domino API - Overview Introduction
OpenNTF Domino API - Overview IntroductionOpenNTF Domino API - Overview Introduction
OpenNTF Domino API - Overview IntroductionPaul Withers
 
Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)
Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)
Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)Etiene Dalcol
 
Http programming in play
Http programming in playHttp programming in play
Http programming in playKnoldus Inc.
 
Apache Sling as an OSGi-powered REST middleware
Apache Sling as an OSGi-powered REST middlewareApache Sling as an OSGi-powered REST middleware
Apache Sling as an OSGi-powered REST middlewareRobert Munteanu
 
Acceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAcceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAsko Soukka
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Codemotion
 

Mais procurados (20)

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
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introduction
 
Introduction to Laravel
Introduction to LaravelIntroduction to Laravel
Introduction to Laravel
 
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
 
Laravel Webcon 2015
Laravel Webcon 2015Laravel Webcon 2015
Laravel Webcon 2015
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! Framework
 
About Node.js
About Node.jsAbout Node.js
About Node.js
 
DanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino APIDanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino API
 
ASP.NET vNext ANUG 20140817
ASP.NET vNext ANUG 20140817ASP.NET vNext ANUG 20140817
ASP.NET vNext ANUG 20140817
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.js
 
A introduction to Laravel framework
A introduction to Laravel frameworkA introduction to Laravel framework
A introduction to Laravel framework
 
Alfresco 5.2 REST API
Alfresco 5.2 REST APIAlfresco 5.2 REST API
Alfresco 5.2 REST API
 
ASP.NET Core 1.0
ASP.NET Core 1.0ASP.NET Core 1.0
ASP.NET Core 1.0
 
Fluentd v1 and Roadmap
Fluentd v1 and RoadmapFluentd v1 and Roadmap
Fluentd v1 and Roadmap
 
OpenNTF Domino API - Overview Introduction
OpenNTF Domino API - Overview IntroductionOpenNTF Domino API - Overview Introduction
OpenNTF Domino API - Overview Introduction
 
Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)
Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)
Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)
 
Http programming in play
Http programming in playHttp programming in play
Http programming in play
 
Apache Sling as an OSGi-powered REST middleware
Apache Sling as an OSGi-powered REST middlewareApache Sling as an OSGi-powered REST middleware
Apache Sling as an OSGi-powered REST middleware
 
Acceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAcceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and selenium
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
 

Semelhante a A Brief History of OWIN

Owin and Katana
Owin and KatanaOwin and Katana
Owin and KatanaUgo Lattanzi
 
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Eugene Yokota
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with serverEugene Yokota
 
CocoaConf DC - Automate with Swift - Tony Ingraldi
CocoaConf DC -  Automate with Swift - Tony IngraldiCocoaConf DC -  Automate with Swift - Tony Ingraldi
CocoaConf DC - Automate with Swift - Tony IngraldiTony Ingraldi
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9Ivan Krylov
 
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogicRakuten Group, Inc.
 
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...Jean Vanderdonckt
 
Lecture 8 - Qooxdoo - Rap Course At The University Of Szeged
Lecture 8 - Qooxdoo - Rap Course At The University Of SzegedLecture 8 - Qooxdoo - Rap Course At The University Of Szeged
Lecture 8 - Qooxdoo - Rap Course At The University Of SzegedFabian Jakobs
 
VASmalltalk, Today and Tomorrow
VASmalltalk, Today and TomorrowVASmalltalk, Today and Tomorrow
VASmalltalk, Today and TomorrowESUG
 
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Enginecatherinewall
 
Rapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINARapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINAtrustinlee
 
Ratpack Web Framework
Ratpack Web FrameworkRatpack Web Framework
Ratpack Web FrameworkDaniel Woods
 
JCON_15FactorWorkshop.pptx
JCON_15FactorWorkshop.pptxJCON_15FactorWorkshop.pptx
JCON_15FactorWorkshop.pptxGrace Jansen
 
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]Leonardo Zanivan
 
Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3Asher Martin
 
C++ Windows Forms L01 - Intro
C++ Windows Forms L01 - IntroC++ Windows Forms L01 - Intro
C++ Windows Forms L01 - IntroMohammad Shaker
 

Semelhante a A Brief History of OWIN (20)

Owin and Katana
Owin and KatanaOwin and Katana
Owin and Katana
 
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)
 
Campus days 2014 owin
Campus days 2014 owinCampus days 2014 owin
Campus days 2014 owin
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
CocoaConf DC - Automate with Swift - Tony Ingraldi
CocoaConf DC -  Automate with Swift - Tony IngraldiCocoaConf DC -  Automate with Swift - Tony Ingraldi
CocoaConf DC - Automate with Swift - Tony Ingraldi
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9
 
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic
 
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...
 
Lecture 8 - Qooxdoo - Rap Course At The University Of Szeged
Lecture 8 - Qooxdoo - Rap Course At The University Of SzegedLecture 8 - Qooxdoo - Rap Course At The University Of Szeged
Lecture 8 - Qooxdoo - Rap Course At The University Of Szeged
 
Philly Tech Fest Iis
Philly Tech Fest IisPhilly Tech Fest Iis
Philly Tech Fest Iis
 
VASmalltalk, Today and Tomorrow
VASmalltalk, Today and TomorrowVASmalltalk, Today and Tomorrow
VASmalltalk, Today and Tomorrow
 
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
 
Rapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINARapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINA
 
Owin
OwinOwin
Owin
 
Ratpack Web Framework
Ratpack Web FrameworkRatpack Web Framework
Ratpack Web Framework
 
JCON_15FactorWorkshop.pptx
JCON_15FactorWorkshop.pptxJCON_15FactorWorkshop.pptx
JCON_15FactorWorkshop.pptx
 
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
JavaOne 2014 - Scalable JavaScript Applications with Project Nashorn [CON6423]
 
Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3
 
C++ Windows Forms L01 - Intro
C++ Windows Forms L01 - IntroC++ Windows Forms L01 - Intro
C++ Windows Forms L01 - Intro
 

Mais de Ryan Riley

Test first
Test firstTest first
Test firstRyan Riley
 
Introduction to F#x
Introduction to F#xIntroduction to F#x
Introduction to F#xRyan Riley
 
The Functional Web
The Functional WebThe Functional Web
The Functional WebRyan Riley
 
Rx workshop
Rx workshopRx workshop
Rx workshopRyan Riley
 
Functional Programming
Functional ProgrammingFunctional Programming
Functional ProgrammingRyan Riley
 
Practical F#
Practical F#Practical F#
Practical F#Ryan Riley
 
HTTP: the Other ESB
HTTP: the Other ESBHTTP: the Other ESB
HTTP: the Other ESBRyan Riley
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignRyan Riley
 

Mais de Ryan Riley (8)

Test first
Test firstTest first
Test first
 
Introduction to F#x
Introduction to F#xIntroduction to F#x
Introduction to F#x
 
The Functional Web
The Functional WebThe Functional Web
The Functional Web
 
Rx workshop
Rx workshopRx workshop
Rx workshop
 
Functional Programming
Functional ProgrammingFunctional Programming
Functional Programming
 
Practical F#
Practical F#Practical F#
Practical F#
 
HTTP: the Other ESB
HTTP: the Other ESBHTTP: the Other ESB
HTTP: the Other ESB
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 

Último

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 

Último (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 

A Brief History of OWIN

  • 1. 0 A Brief History of OWIN Ryan Riley
  • 2. Welcome to Houston TechFest • Please turn off all electronic devices or set them to vibrate. • If you must take a phone call, please do so in the lobby so as not to disturb others. • Thanks to our Diamond Sponsors: Thank you for being a part of the 9th Annual Houston TechFest!
  • 3. 2 Please Leave Feedback During Q&A If you leave session feedback and provide contact information in the survey, you will be qualified for a prize Scan the QR Code to the right or go to http://bit.ly/1K1Hvi5
  • 4. 3 Ryan Riley • Engineer at Tachyus • OWIN Management Committee • ASPInsider • Visual F# MVP • Leads Community for F#
  • 5. 4 Click to edit Master title style Why OWIN? Open Web Interface for .NET
  • 6. 5 Click to edit Master title style Problem: Desire for Fast and Light-weight Frameworks and Servers ASP.NET was “too heavy” IIS was “too slow” ASP.NET was coupled to IIS Hard to do REST
  • 7. 6 Solutions • Boat • Figment • Fracture • Frank • FubuMVC • KayakHTTP • NancyFx • Nina • NRack • OpenRasta • Suave • WCF Web API (later ASP.NET Web API) • Among others
  • 8. 7 Click to edit Master title style Problem: Repetition Sinatra in .NET ASP.NET adapters Self-host adapters (esp. HttpListener)
  • 10. 9 September 7, 2010 I’ve noticed a trend recently in projects each of us has worked/is working on and wondered if we might be willing to pool our resources.... If you are interested in working together, please let me know.... I’m sure we could agree on a common platform for our efforts. - Email from Ryan Riley (Frank) to Benjamin van der Veen (KayakHTTP), Mauricio Scheffer (Figment), and Scott Koon (Boat)
  • 11. 10 September 27, 2010 Benjamin van der Veen submits first draft of interfaces public interface IHttpResponder { IObservable<IHttpServerResponse> Respond( IHttpServerRequest request, IDictionary<string, object> context ); } public interface IHttpServerRequest { HttpRequestLine RequestLine { get; } IDictionary<string, string> Headers { get; } IObservable<ArraySegment<byte>> GetBodyChunk(); } public interface IHttpServerResponse { HttpStatusLine StatusLine { get; } IDictionary<string, string> Headers { get; } string BodyFile { get; } IObservable<ArraySegment<byte>> GetBodyChunk(); }
  • 12. 11 November 29, 2010 Scott Koon creates .NET HTTP Abstractions • Now called OWIN Working Group • https://groups.google.com/forum/#!forum/ net-http-abstractions
  • 13. 12 Click to edit Master title style Problem: Opinions and Existing Implementations
  • 14. 13 Solution: Define a Common Interface • Rack (Ruby) • WSGI (Python)
  • 15. 14 Consensus to share server wrappers
  • 16. 15 Progress! • Name: Open Web Interface for .NET (OWIN) • Began writing specification • BHAG: run ASP.NET MVC on top
  • 17. 16 Click to edit Master title style Problem: Trouble in Paradise
  • 18. 17 Solutions Factions • Which interfaces / types? • Require a library dependency? • OOP vs FP • Static vs Dynamic typing Solutions • Only types from the FCL • No library dependency • Delegates + • IDictionary<string, object>
  • 19. 18 Click to edit Master title style Problem: How to represent async access to the message body?
  • 20. 19 Proposed Solution #1: System.IO.Stream • Considered “too heavy” as an interface • Async access considered “too slow” due to APM model • Rejected
  • 21. 20 Proposed Solution #2: System.IObservable<T> • Concerned about back-pressure • Required library dependency for .NET 3.5 • Rejected
  • 22. 21 Proposed Solution #3: Task • Required (then new) .NET 4.0 • Some contributors had an established .NET 3.5 user base • Rejected
  • 23. 22 Proposed Solution #4: “Delegate of Doom” public delegate void AppDelegate( IDictionary<string, object> env, ResultDelegate result, Action<Exception> fault); public delegate void ResultDelegate( string status, IDictionary<string, IEnumerable<string>> headers, BodyDelegate body); public delegate void BodyDelegate( Func<ArraySegment<byte>, bool> write, Func<Action, bool> flush, Action<Exception> end, CancellationToken cancellationToken); • Accepted!
  • 24. 23 Click to edit Master title style Problem: “Delegate of Doom” difficult to implement
  • 25. 24 Solution: Gate reference / helper library Image from “The Reality of a Developer's Life - in GIFs, Of Course”
  • 26. 25 Click to edit Master title style WIN: SignalR chooses OWIN!
  • 27. 26 Click to edit Master title style Problem: SignalR not compatible with “Delegate of Doom”
  • 28. 27 Single Tap • SignalR • ASP.NET • Fubu MVC • Razor • node.js
  • 29. 28 Double Tap • OWIN (with “Delegate of Doom”) • ASP.NET Web API • Frank • NancyFX • Rack (Ruby)
  • 30. 29 Solution using Environment = IDictionary<string, object> using AppFunc = Func<Environment, Task>
  • 31. 30 Task? • Accepted on August 22, 2012 • 2 years makes a big difference
  • 32. 31 The OWIN Specification http://owin.org/html/owin.html 1. Overview 2. Definitions 3. Request Execution 3.1. Application Delegate 3.2. Environment 3.3. Headers 3.4. Request Body 3.5. Response Body 3.6. Request Lifetime 4. Application Startup 5. URI Reconstruction 5.1. URI Scheme 5.2. Hostname 5.3. Paths 5.4. URI Reconstruction Algorithm 5.5. Percent-encoding 6. Error Handling 6.1. Application Errors 6.2. Server Errors 7. Versioning
  • 33. 32 Request Keys • owin.RequestBody : Stream • owin.RequestHeaders : IDictionary<string, string[]> • owin.RequestMethod : string • owin.RequestPath : string • owin.RequestPathBase : string • owin.RequestProtocol : string • owin.RequestQueryString : string • owin.RequestScheme : string • owin.RequestId* : optional string • owin.RequestUser* : optional ClaimsPrincipal
  • 34. 33 Response Keys • owin.ResponseBody : Stream • owin.ResponseHeaders : IDictionary<string, string[]> • owin.ResponseStatusCode : optional int (default is 200) • owin.ResponseReasonPhrase : optional string (default set by server) • owin.ResponseProtocol : optional string
  • 35. 34 Other Data • owin.CallCancelled : CancellationToken • owin.Version : string
  • 36. 35 Using AppFunc using System.IO; using System.Text; using Headers = IDictionary<string, string[]>; var app = AppFunc(env => { var bytes = Encoding.UTF8.GetBytes("Hello, OWIN!"); var length = bytes.Length.ToString(); var headers = (Headers)env.["owin.ResponseHeaders"]; headers.Add("Content-Type", new[] { "text/plain" }); headers.Add("Content-Length", new[] { length }); var stream = (Stream)env.["owin.ResponseBody"]; return stream.WriteAsync(bytes, 0, bytes.Length); });
  • 37. 36 Flexibility: AppFunc as a Class public class MyApp { public Task Invoke(Environment env) { var bytes = Encoding.UTF8.GetBytes("Hello, OWIN!"); var length = bytes.Length.ToString(); var headers = (Headers)env.["owin.ResponseHeaders"]; headers.Add("Content-Type", new[] { "text/plain" }); headers.Add("Content-Length", new[] { length }); var stream = (Stream)env.["owin.ResponseBody"]; return stream.WriteAsync(bytes, 0, bytes.Length); } }
  • 38. 37 Flexibility: AppFunc as a Method public class MyApps { public Task MyApp1(Environment env) { // uses state from MyApps } public static Task MyApp2(Environment env) { // does not use MyApps’ state } }
  • 39. 38 AppFunc Composition public static class Logging { public static Task LogBefore(Environment env) { /**/ } public static Task LogAfter(Environment env) { /**/ } public static ???? Log(????) { LogBefore(env); // call something else, but how? LogAfter(env); } }
  • 40. 39 Middleware using MidFunc = Func<AppFunc, AppFunc>; public static class Logging { public static Task LogBefore(Environment env) { /**/ } public static Task LogAfter(Environment env) { /**/ } public static AppFunc Log(AppFunc next) { return async env => { LogBefore(env); await next(env); LogAfter(env); }; } }
  • 41. 40 Middleware as a Class public class Logging { AppFunc next; public Logging(AppFunc next) { this.next = next; } static Task LogBefore(Environment env) { /**/ } static Task LogAfter(Environment env) { /**/ } public async Task Invoke(Environment env) { LogBefore(env); await this.next(env); LogAfter(env); } }
  • 42. 41 OO AppFunc Composition public class Startup { private readonly AppFunc composed; public Startup(AppFunc next) { this.composed = Logging.Log(next); } public Task Invoke(Environment env) { return this.composed(env); } }
  • 43. 42 Functional AppFunc Composition public static class Startup { static readonly AppFunc next = ...; static readonly AppFunc composed = Logging.Log(next); public static Task Invoke(Environment env) { return Startup.composed(env); } }
  • 44. 43 Goals Achieved No dependencies Flexibility of style Server independence
  • 45. 44 Bonus! Simple composition Can construct dynamic execution graphs* No server required (easy to unit test)
  • 46. 45 Click to edit Master title style Push to 1.0
  • 47. 46 Microsoft and others adopt OWIN • Microsoft.Owin, a.k.a. Katana • Fix • Freya • SimpleOwin • Simple.Owin • Suave • WebSharper
  • 48. 47 Server Support • System.Web • HttpListener • IIS (Helios) • Nowin (cross-platform) • Suave (cross-platform)
  • 49. 48 Middleware • CORS • Security • Routing (Superscribe) • Diagnostics • Many more!
  • 50. 49 Put It All Together // Using Microsoft.Owin public class Startup { public void Configuration(IAppBuilder app) { app.Properties["host.AppName"] = "composed app"; app.UseCors(Cors.CorsOptions.AllowAll) .MapSignalR() .UseWebApi(new HttpConfiguration()) .UseNancy(); } }
  • 51. 50 Artifact: owin.dll • Originally intended to provide the delegate signatures • IAppBuilder was later added and left as the only interface • IAppBuilder was not spec’d and had no connection to AppFunc public interface IAppBuilder { IDictionary<string, object> Properties { get; } IAppBuilder Use(object middleware, params object[] args); object Build(Type returnType); IAppBuilder New(); }
  • 52. 51 Click to edit Master title style Moving Forward
  • 53. 52 OWIN Management Committee • Established governance model • Converted specs to Markdown (https://github.com/owin/owin) • GitHub Issues to submit and vote on changes (https://github.com/owin/owin/issues)
  • 54. 53 Formalized Middleware Signature • Specification in draft using MidFunc = Func<AppFunc, AppFunc> using MidFactory = Func< IDictionary<string, object>, // startup properties MidFunc // outer Middleware > using BuildFunc = Action<MidFactory>
  • 55. 54 BHAG: ASP.NET vNext and MVC 6 • Achievement unlocked … • … sort of
  • 56. 55 Two Steps Back (Step 1) https://twitter.com/jchannon/status/641312171918553088
  • 57. 56 ASP.NET 5 and DNX Support public void Configure(IApplicationBuilder app) { app.UseCookieAuthentication(options => { options.AutomaticAuthentication = true; options.AuthenticationScheme = CookieAuthenticationDefaults.AuthenticationScheme; }); app.UseTwitterAuthentication(configureOptions => { configureOptions.ConsumerKey = TWITTERCONSUMERKEY; configureOptions.ConsumerSecret = TWITTERSECRET; }); app.UseOwin(x => x.UseNancy()); }
  • 58. 57 Two Steps Back (Step 2) Different opinions about: • Discovery, i.e. IAppBuilder • Middleware
  • 59. 58 Katana-style Middleware • “Soft 404” • Linear pipeline set at compile time • Possible to branch using IAppBuilder.Map
  • 60. 59 Dynamic Pipeline • Techniques used by Damian Hickey and Sebastian Lambla • Middleware builds and executes its own pipeline • Can change during runtime • See an example
  • 61. 60 Graph-based Execution • Superscribe – routing • Freya – web machine
  • 62. 61 Verdict: Middleware Wins • Still more ideas to try out! • What are yours?
  • 64. 63 Get Involved! • Submit your feedback on the specs • Help us with governance • Propose and vote on next steps • http://owin.org/ • https://github.com/owin/owin/issues • http://groups.google.com/group/net-http-abstractions
  • 65. Please Leave Feedback During Q&A If you leave session feedback and provide contact information in the survey, you will be qualified for a prize Scan the QR Code to the right or go to http://bit.ly/1K1Hvi5
  • 66. Thanks to all our Sponsors!

Notas do Editor

  1. A Problem / Solution review of the evolution of the Open Web Interface for .NET
  2. In order to understand why we created OWIN, you have to put yourself back into 2010. Ruby on Rails, introduced in 2005, made MVC very popular by 2007-2008. Rack, Sinatra, and similar efforts appeared in other platforms simultaneously. ASP.NET MVC came out in the Spring of 2009. NuGet wasn’t released until late fall of 2010. WebForms was still the dominant platform for web apps. WCF was the go-to for web services. Both MVC and WebForms were tied to IIS.
  3. Throughout 2010, many solutions appeared, both in terms of optional frameworks and servers.
  4. Nearly all the frameworks created targeted something similar to Ruby’s Sinatra. Nearly all had mostly identical adapters for running their framework on ASP.NET / IIS, HttpListener, and/or other servers.
  5. http://despair.com/products/collaboration
  6. Solution: collaboration!
  7. Collaboration is always a good idea, so long as others collaborate with you and use your ideas. Since so many had already created solutions and started growing a following, they were understandably hesitant to just drop what they had and adopt some common solution. We had to agree on what we could share and how we could share it.
  8. Sebastian Lambla proposed the name “OWIN,” and it stuck. Lou de Jardin and Benjamin van der Veen started writing the spec under the guidance of Jason Sirota. We actually had a decent organization around all this effort early on, including support from MonkeySpace coordinator Dale Ragan. We decided we would also attempt to lift MVC off ASP.NET and get it running on OWIN as our BHAG. Conference sessions were scheduled, and implementations began to appear as proposals for adoption.
  9. Since most everyone had by this time developed their own context, request, and response types that they very much liked and had built around, no one really wanted to budge and agree on a standard set of interfaces. The existing HttpContext, HttpRequest, and HttpResponse types from ASP.NET played into this, as well, as most of us realized we would probably get something wrong and then have to renegotiate over how to version the shared library. A few, prominent voices pushed hard for avoiding a shared library, and rather than lose them, we agreed to go without a shared library. As you might expect, this greatly limited our type options. Many ask about the reason for selecting delegates and an un-typed dictionary. To understand, you must remember the context of the time. IronPython and IronRuby were still in active development by Microsoft, and several of the early contributors to OWIN came from those language communities. We perceived the use of the dictionary would better map to those languages existing interfaces (Rack / Python) and had a general idea that we would like to try to make it easy to adapt tools like Rack and WSGI implementations to work with OWIN. Further, the use of a dictionary satisfied the requirement to use FCL types and allowed for further iteration in the future by changing only the spec and not the implementations. We thought this also better supported and encouraged use of feature detection – which was needed anyway to take advantage of server-specific features – rather than relying on forced type constraints. As for the delegates, a delegate may represent a class with a constructor and a single method, and we found this sufficient for our needs. Some suggested such things as Church-encoding to map to actual types, but the majority felt this was too complicated to use in the spec and that should such a thing be wanted, it could be layered on top.
  10. The last decision came down to how to represent asynchronous access to request and response streams. Rack and WSGI had by this time recognized this was very nice to have but had already committed to synchronous access and had to adopt work-arounds. We wanted to address this head on, but we we had a long deliberation as to how to do so.
  11. Image from “The Reality of a Developer's Life - in GIFs, Of Course” (http://server.dzone.com/articles/reality-developers-life-gifs) Wait a minute. Didn’t we say we didn’t want a dependency library? Gate became a sort of relied upon library for using the Delegate of Doom, though some managed to build their own implementations. NOTE: Gate became the basis for Microsoft’s Katana (Microsoft.Owin) library(-ies).
  12. Image from “The Reality of a Developer's Life - in GIFs, Of Course” (http://server.dzone.com/articles/reality-developers-life-gifs) Wait a minute. Didn’t we say we didn’t want a dependency library? Gate became a sort of relied upon library for using the Delegate of Doom, though some managed to build their own implementations. NOTE: Gate became the basis for Microsoft’s Katana (Microsoft.Owin) library(-ies).
  13. https://groups.google.com/d/msg/net-http-abstractions/Cbvy2x27Few/Oor2UwA0W1wJ Explained There are ways to run a single-tap web framework on a double-tap owin pipeline, but they all boil down to buffering write data.... Increased complexity, more memory to hold the body until the fwk returns, and cpu spent copying that data… Plus for fully synchronous web frameworks it means every response body will be entirely buffered because there’s no way for the server to deliver the output stream until the initial call returns. ... it’s pretty extreme compared to just passing the server’s output stream and a response header idictionary in the original call. Running a double-tap framework on a single-tap pipeline by comparison is easy – the adapter just calls framework then calls its callback with the output stream.
  14. https://groups.google.com/d/msg/net-http-abstractions/Cbvy2x27Few/Oor2UwA0W1wJ Explained There are ways to run a single-tap web framework on a double-tap owin pipeline, but they all boil down to buffering write data.... Increased complexity, more memory to hold the body until the fwk returns, and cpu spent copying that data… Plus for fully synchronous web frameworks it means every response body will be entirely buffered because there’s no way for the server to deliver the output stream until the initial call returns. ... it’s pretty extreme compared to just passing the server’s output stream and a response header idictionary in the original call. Running a double-tap framework on a single-tap pipeline by comparison is easy – the adapter just calls framework then calls its callback with the output stream.
  15. Wait, how did Task suddenly reappear?
  16. By this time, most everyone still involved had upgraded to .NET 4.0 or at least no longer cared about supporting .NET 3.5. August 22, 2012, coincidentally the birthdate of my youngest daughter.
  17. The last two were added in the 1.0.1 draft.
  18. * More on dynamic execution graphs later.
  19. IAppBuilder was meant as a discovery mechanism. No one wrote a spec for the interface, so implementations varied, some adding lifecycle semantics that conflicted with other implementations. At present, this interface is deprecated though still available on NuGet and available for use by original implementations.
  20. Early in the development of vNext, things looked really good for OWIN. vNext appeared to build on the work of Katana. However, something happened along the way to shift the direction of vNext away from OWIN.
  21. The good news is ASP.NET 5 still supports OWIN, though it’s more a bolt-on than a first-class citizen. OWIN’s simplicity, on the other hand, ensures it should work just fine on DNX, though you will need to build out host / server support if you don’t want to run through ASP.NET.
  22. As noted earlier, IAppBuilder appeared without anyone really noticing it. However, it quickly took center stage and shifted the focus off the goals of OWIN and onto a particular discovery and composition model that had never really been discussed. IAppBuilder’s acceptance of Object as its input to its Use member caused most of the problems. We didn’t think we needed to define Middleware at the outset because several of us thought the composition model so obvious. IAppBuilder obstructed the clarity and shifted the focus of middleware to a lesser form of use in which middleware stood in line and handled or ignored an OWIN environment until one of them completed the Task. While quite ingenious and useful, this became the standard pattern. Only later did some really useful patterns for graph-based routing, dynamic pipeline composition, and more finally emerge. In any case, Middleware has been both a challenge and one of the most exciting aspects of OWIN. Examples follow.
  23. All of the above are perfectly valid and further highlight the flexibility of OWIN.