Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Owin from spec to application

2,104 views

Published on

Slides from DotNed user group, June 2014

Published in: Software
  • Be the first to comment

  • Be the first to like this

Owin from spec to application

  1. 1. OWIN : From Spec to Application Damian Hickey @randompunter / dhickey.ie dotned, 26 June 2014
  2. 2. > whoami • Not a web or http expert!
  3. 3. My Pain Web APP IIS Windows Service SQL Database WCF
  4. 4. Everyone does their own thing • ServiceStack Selfhost • Nancy Selfhost • WebAPI Selfhost • WCF Selfhost • OpenRasta Selfhost • etc
  5. 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
  6. 6. Part 1 – OWIN Open Web Interface for .NET
  7. 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
  8. 8. ASP.NET Life Cycle (Browser)
  9. 9. 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
  10. 10. 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
  11. 11. Terminology • Host • Middleware • Web Framework • Web Application • Process (aka Sever)
  12. 12. IIS SystemWeb Helios HttpListener WebListener Nowin HTTTP.SYS Sockets Kestrel (libuv) NGIX Apache (FastCGI FIOS OWIN (AppFunc) Application - Nancy - WebAPI - Security - Compression - FileServer - WebSockets - MVC 6 - Mapping - Limiting - StatusCodeHandling - ViewEngines - Routing - etc
  13. 13. Headers Request Stream Body Stream Headers Response Stream Body Stream OWIN
  14. 14. The Core – The Application Function • Aka “AppFunc” • That’s it!
  15. 15. App
  16. 16. The Environment Dictionary • IDictionary<string, object> • Has a set of well-defined keys and value types • Stores Request & Response data • Is mutable
  17. 17. The Environment (Browser, owin.org)
  18. 18. Middleware Middleware is a pipeline Middleware Middleware
  19. 19. Middleware
  20. 20. 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
  21. 21. Code (VS)
  22. 22. Testing
  23. 23. Resources • owin.org • katanaproject.codeplex.com • #owin chat room on jabbr.net • .NET HTTP Abstractions google group • github.com/owin

×