0
11/2013
Agenda
A brief history…
What is OWIN?
What is Katana?
How this works?
Demo

2
A brief history…
• 1996: ASP – Vbscript in page, no SOC.
• 2002: ASP.Net
•
•
•
•
•

Separation between design (aspx) and b...
A brief history…
• 2009: ASP .Net MVC
•
•
•
•
•

MVC design pattern, SOC!
Out of band, not included in .Net Framework -> i...
A brief history…
• 2012: ASP .Net Web Api
• “Shift from dynamic, server-generated Web pages to static initial
markup with ...
A brief history…
• 2013: ASP .Net SignalR
• As stated on Wikipedia’s page: “SignalR allows server-side code
push content t...
Why not hosting on IIS?
• Use small, lightweight web server
• Avoid IIS performance overhead
• IIS might not be available…...
How?
If you want something being re-hostable on different
server implementations, you cannot reference anything
from a spe...
What is OWIN?
• OWIN stands for: The Open Web Interface for .NET
• Inspired by Rack in the Ruby community
• It creates an ...
What is Katana?
• Katana is « just » Microsoft’s own implementation of
OWIN rules!

10
How this works?
• Two core elements
– Environment dictionary:
• IDictionary<string, object>

• “An OWIN-compatible Web ser...
How this works?
– Application delegate:
• Func<IDictionary<string, object>, Task>;
• “The application delegate an implemen...
How this works?
Host: The process that runs the application : IIS / Custom
Server: Responsible for binding to a TCP port, ...
Who is Owined?
Servers and Hosts

Framework

Katana

Nancy

Nowin

SignalR
WebApi
FubuMVC
Simple.Web
DuoVia.Http

14
DEMO!

15
Demo
The purpose of the demo is to show how to easy it is to create a
simple “Hello World!” in 2 steps:
• Running the OWIN...
Demo
 Create a new “ASP.NET Empty Web Application”

17
Demo
 Install the “Microsoft.Owin.Host.SystemWeb” nuget package (via the Package
Manager Console or the Manage Nuget Pack...
Demo
 Add a “Startup” class to your project (convention)

19
Demo
 Add this piece of code to your “Startup.cs” class

20
Demo
 Press F5!

 Step1: Accomplished!
21
Demo
Step 2: Get rid of IIS 
 Install the “OwinHost” nuget package (via the Package Manager Console or the
Manage Nuget ...
Demo
 Remove all your System.Web* references and your Web.config file, from your
project:

23
Demo
 Remove “using System.Web;” line from your “Startup.cs” class
 Rebuild your project
 Open a “Developer Command Pro...
Demo
 Open a browser and go to: http://localhost:5000/

 Step2: Accomplished!
25
Questions?

26
To go further…
Katana Project
Getting Started with the Katana Project
An Overview of Project Katana
Getting started with O...
Find out more
• On https://techblog.betclicgroup.com/
About Betclic
•

•

•

Betclic Everest Group, one of the world leaders in online gaming, has a unique portfolio
comprising...
Upcoming SlideShare
Loading in...5
×

Mini-Training Owin Katana

3,907

Published on

Discover what are OWIN and Katana projects, and how Microsoft became able to release a family of modular components rather than a monolithic framework.

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,907
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
48
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

Transcript of "Mini-Training Owin Katana"

  1. 1. 11/2013
  2. 2. Agenda A brief history… What is OWIN? What is Katana? How this works? Demo 2
  3. 3. A brief history… • 1996: ASP – Vbscript in page, no SOC. • 2002: ASP.Net • • • • • Separation between design (aspx) and business code (C#/VB.Net) Lesser learning curve for WinForms devs. Stateful event model :-( Monolithic framework Tied to .Net framework releases! 3
  4. 4. A brief history… • 2009: ASP .Net MVC • • • • • MVC design pattern, SOC! Out of band, not included in .Net Framework -> independent. Faster release cycles Open source! But still tied to System.Web.dll -> dependencies to IIS :-( 4
  5. 5. A brief history… • 2012: ASP .Net Web Api • “Shift from dynamic, server-generated Web pages to static initial markup with dynamic sections of the page generated from clientside script communicating with backend Web APIs through AJAX requests“ • Delivered with Nuget • No dependencies on System.Web.dll -> more modular framework • Custom host! Devs can use a lightweight host for their services. 5
  6. 6. A brief history… • 2013: ASP .Net SignalR • As stated on Wikipedia’s page: “SignalR allows server-side code push content to the connected clients as it happens, in real-time.“ • Can be self hosted as well 6
  7. 7. Why not hosting on IIS? • Use small, lightweight web server • Avoid IIS performance overhead • IIS might not be available… 7
  8. 8. How? If you want something being re-hostable on different server implementations, you cannot reference anything from a specific server’s implementation! Here comes 8
  9. 9. What is OWIN? • OWIN stands for: The Open Web Interface for .NET • Inspired by Rack in the Ruby community • It creates an abstraction between Web servers and framework components • It’s an open standard • Authored by 2 MS guys: Benjamin Vanderveen and Louis Dejardin 9
  10. 10. What is Katana? • Katana is « just » Microsoft’s own implementation of OWIN rules! 10
  11. 11. How this works? • Two core elements – Environment dictionary: • IDictionary<string, object> • “An OWIN-compatible Web server is responsible for populating the environment dictionary with data such as the body streams and header collections for an HTTP request and response. It is then the responsibility of the application or framework components to populate or update the dictionary with additional values and write to the response body stream.” 11
  12. 12. How this works? – Application delegate: • Func<IDictionary<string, object>, Task>; • “The application delegate an implementation of the Func delegate type where the function accepts the environment dictionary as input and returns a Task.” • The asynchronous design enables the abstraction to be efficient with its handling of computing resources, particularly in more I/O intensive operations. • Because the application delegate is an atomic unit of execution and because the environment dictionary is carried as a parameter on the delegate, OWIN components can be easily chained together to create complex HTTP processing pipelines. 12
  13. 13. How this works? Host: The process that runs the application : IIS / Custom Server: Responsible for binding to a TCP port, constructing the environment dictionary and processing requests through an OWIN pipeline. Middleware: The name given to all of the components that handle requests in an OWIN pipeline: a component that exposes the application delegate. Application: This is your code! © MSDN 13
  14. 14. Who is Owined? Servers and Hosts Framework Katana Nancy Nowin SignalR WebApi FubuMVC Simple.Web DuoVia.Http 14
  15. 15. DEMO! 15
  16. 16. Demo The purpose of the demo is to show how to easy it is to create a simple “Hello World!” in 2 steps: • Running the OWIN pipeline on IIS as part of the ASP .NET request flow • Move to a command-line host and get rid off any IIS dependencies For those who were not present, here are some screenshots of the demo. 16
  17. 17. Demo  Create a new “ASP.NET Empty Web Application” 17
  18. 18. Demo  Install the “Microsoft.Owin.Host.SystemWeb” nuget package (via the Package Manager Console or the Manage Nuget Package window) 18
  19. 19. Demo  Add a “Startup” class to your project (convention) 19
  20. 20. Demo  Add this piece of code to your “Startup.cs” class 20
  21. 21. Demo  Press F5!  Step1: Accomplished! 21
  22. 22. Demo Step 2: Get rid of IIS   Install the “OwinHost” nuget package (via the Package Manager Console or the Manage Nuget Package window)  It deploys OwinHost.exe in the “Packages” folder: 22
  23. 23. Demo  Remove all your System.Web* references and your Web.config file, from your project: 23
  24. 24. Demo  Remove “using System.Web;” line from your “Startup.cs” class  Rebuild your project  Open a “Developer Command Prompt” window and go to the “bin” folder of your application. Then run “OwinHost.exe”: 24
  25. 25. Demo  Open a browser and go to: http://localhost:5000/  Step2: Accomplished! 25
  26. 26. Questions? 26
  27. 27. To go further… Katana Project Getting Started with the Katana Project An Overview of Project Katana Getting started with Owin and Katana OWIN, Katana and SignalR – Breaking free from your Web Server Simple Logging Middleware Visual Studio 2013 Custom Web Servers and OwinHost.exe Tutorial: SignalR Self-Host Use OWIN to Self-Host ASP.NET Web API Host authentication and Web API with OWIN and active vs. passive authentication middleware Creating a simple REST like service with OWIN – Open Web Server Interface 27
  28. 28. Find out more • On https://techblog.betclicgroup.com/
  29. 29. About Betclic • • • Betclic Everest Group, one of the world leaders in online gaming, has a unique portfolio comprising various complementary international brands: Betclic, Everest Gaming, bet-athome.com, Expekt… Active in 100 countries with more than 12 million customers worldwide, the Group is committed to promoting secure and responsible gaming and is a member of several international professional associations including the EGBA (European Gaming and Betting Association) and the ESSA (European Sports Security Association). Through our brands, Betclic Everest Group places expertise, technological know-how and security at the heart of our strategy to deliver an on-line gaming offer attuned to the passion of our players.
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×