4. Everyone does their own thing
• ServiceStack Selfhost
• Nancy Selfhost
• WebAPI Selfhost
• WCF Selfhost
• OpenRasta Selfhost
• etc
5. The Plan
• Part 1: OWIN
• Raison d'être
• Design goals
• The Specification
• Part 2: Implementations
• Hosts & Middleware
• Testing
• Samples & Recipes
• Part 3: OWIN in the wild
7. Prior Art
• System.Web
• Complicated lifecycle
• Doesn’t look like HTTP
• Tied to IIS, in most part
• Difficult to test
• Doesn’t look like HTTP
• Web Forms (let’s not talk about that)
• MVC rests on same System.Web bits as Web Forms
• Python: Web Server Gateway Interface (WSGI)
• Ruby: Rack
• JavaClojure: Ring
10. What is OWIN?
• A specification, not a technology, created by the
community
• Defines a standard, minimal, interface between
.NET web servers and web applications
• Decouples server from applications / frameworks
11. Design Goals
• Super simple signature for Applications and
Middleware
• Dependency free (library and config)
• Asynchronous and concurrent by design
• Respect HTTP – Requests, Responses, Headers and
Streams
• Composable
17. The Environment Dictionary
• IDictionary<string, object>
• Has a set of well-defined keys and value types
• Stores Request & Response data
• Is mutable
21. Some Rules
• Http pipelining is handled by the server. Do not
respond with 100 Continues
• Never close the response body stream
• Always complete the Task
How you got into owin after leaving web dev.
Left web development in the early 2000 and focused on server applications (tcp/ip, message orientated, desktop apps).
But there was also that thing, WebServices. WCF, WS-DeathStar. Config config config.
Looking for a better way. TeamCity
First motivation is Active Server Pages. VB
Programming model for VB6 developers.
Highly objected orientated and desktop style like
Monolithic
Context, Modules, Handler – to support this.
12 years, lot of code, and entirely untestable.
IIS is fine ish, it’s the SystemWeb is the problem.
Mention IAppBuilder
- Been in development for since 2011
- Async, concurrency coordination, performant
- Flesh out the Request, Response thing.
- Host – The HTTP component that directly communicates with the client and uses OWIN semantics to process requests. Hosts may require an adapter layer that converts to OWIN semantics. Example, HttpListener, SystemWeb - Middleware – Components added to the request processing pipeline that provide additional functionality, e.g. inspection, routing, or modifying request and response messages for a specific purpose.- Web Framework – A self-contained component on top of OWIN exposing its own object model or API that applications may use to facilitate request processing. Web Frameworks may require an adapter layer that converts from OWIN semantics. Frameworks may be used to implement middleware or end points. (NancyFX, ServiceStack)- Web Application – A specific application, possibly built using one or more Web Frameworks and/or Middleware, which is run using OWIN compatible Hosts and Processes. (Jabbr.net, RavenDB)- Process – The executable container an Application and Host run inside of, primarily responsible for application startup. Some Hosts provide their own Processes. (IIS, Console.exe)
- Mention apache, nginx, mono etc
The Environment dictionary stores information about the request, the response, and any relevant server state. The server is responsible for providing body streams and header collections for both the request and response in the initial call. The application then populates the appropriate fields with response data, writes the response body, and returns when done.
The environment dictionary MUST be non-null, mutable and MUST contain the keys listed as required in the tables below.