Herding Code 164: OWIN and Katana with Louis DeJardin

This week on Herding Code, the guys talk to Louis DeJardin about OWIN – the Open Web Interface for .NET – and Katana, an open source OWIN implementation for ASP.NET and IIS.

Download / Listen:

Herding Code 164: OWIN and Katana with Louis DeJardin [audio:http://herdingcode.com/wp-content/uploads/HerdingCode-0164-OWIN.mp3]

Show Notes:

  • Intro
    • (00:44) Scott and Louis explain what OWIN is.
    • (01:33) Louis explains the difference between OWIN (the community standard) and Katana (actual bits – an implementation of the OWIN standard for ASP.NET).
    • (03:18) Jon asks if this is similar to the distinction between HTTP / HTML standards and browser implementations. Louis explains what’s required for an implementer to participate in a request. Each request calls a simple func with an IDictionary<string> which returns a task.
  • The killer app: middleware
    • (04:54) Scott talks about how the pipeline might not sound like much, but it can support a lot of really useful middleware scenarios like static caching and domain splitting – especially in a way that’s common across frameworks.
    • (06:05) Louis talks about the challenge they’ve had in describing the benefit of OWIN in non-academic terms, and that it’s not until you want to apply cross-framework concerns like authentication that OWIN really shines.
    • (07:52) Scott says that previously these kinds of concerns – logging, etc. – were wrapped up in System.Web, and they had performance implications regardless of whether you used them. The pipeline model lets you avoid those hits unless you explicitly want the features.
    • (10:03) Scott mentions some of the frameworks which have implemented OWIN, including NancyFx, Fubu, ServiceStack.
    • (10:50) Kevin says that the current implementation examples are full web frameworks rather than middleware. Louis says that probably because ASP.NET and IIS already had pipeline implementations so there’s less of a forcing function than there was with Node and Ruby. Scott says that since the current implementations already have full stacks, there’s less need to plug in modular solutions. Jon says he thinks that the late arrival of NuGet and other open modular systems like this mean it’ll take a while to get traction.
    • (14:40) Louis says we’ll need a killer app, and HttpListener hosting alone isn’t that. Jon asks if you’d host Katana under IIS to manage the process. Louis says yes, and until there are other hosts than IIS he doesn’t see the hosting as a big draw – he thinks auth is probably it.
    • 1640 Scott says he could see auth frameworks and scaling middleware. Louis says that David Fowler updated JabbR to run on OWIN, and was able to move some of the scale pieces into OWIN middleware.
    • (18:25) Jon asks if he can take an existing ASP.NET application to start taking advantage of middleware without rewriting the application. Louis says that if you add the Microsoft.Owin.Host.SystemWeb NuGet package, you can put an OWIN pipeline on the route table. You can also use an IHttpHandler to plug in middleware. They’re looking at third option – an integrated pipeline module which will delegate to the application if an OWIN handler doesn’t pick it up.
    • (22:22) Jon asks Louis has some other ideas for middleware, and Louis lists several (static file handlers, authentication, etc.) and points to Rack and Node as examples. He lists another example – anti-bot  protection that returns an HTTP 200 for a URL pattern.
    • (23:50) Jon asks if it’s possible to plug things in at runtime. Louis talks about the Startup class – it’s a POCO class so you can easily work with it via IoC, plug things in whenever – it’s just code.
    • (25:05) Scott says he looked at implementing URL rewriting in middleware. Louis explains how this works perfectly with the pipeline and describes how you could also use this to monitor 404s.
    • (26:45) Scott says hosters could implement middleware to set ETAGS, enforce things, etc.
    • (27:40) Louis explains why it’s really powerful to have middleware that’s not coupled to a specific implementation like ASP.NET MVC.
    • (28:35) Jon asks if it’s possible that some of this middleware could run on hardware. Louis says it is, and gives an example with a reverse proxy.
    • (29:57) Scott talks about breaking middleware into application and networking uses and talks of some optimizations that could be done in middleware.
  • Next
    • (31:48) Scott asks where we go from here – are done? What’s the next goal? Louis says the current 1.0 version of Katana has IIS hosting; the 1.1 version will add production grade HttpListener and self host story, and after that it’s about supporting emerging standards and looking for synergies. Louis says documentation would be nice, but Scott says that the model is so simple that there’s not a lot to document.
    • (34:50) Scott and Louis talk about how this will affect the ecosystem in general, with an example of how smoothly the SignalR implementation worked.
    • (35:25) Jon asks about the future for hosters like Azure, AppHarbor, etc. Louis talks about an example for  supporting zip file based deployment, Mono hosting.
  • Getting involved
    • (37:05) Louis talks about what’s available in the Katana Project, including sample code and pre-release packages. The Google Group – net-http-abstractions – is the best place to discus OWIN.
    • (38:15) Jon asks if the Katana project takes pull requests. Louis says it’s run under the MS Open Tech organization and is clear to take pull requests from developers who have signed a contributor license agreement. Jon asks for areas where they’d like help. Scott says he’d like to see lots of middleware; Louis he’d love to see an OWIN Contrib project emerge.
  • Questions from Twitter
    • (41:05) Sean Massa (@endangeredmassa): Is it possible to use the DLR?
    • (41:45) Eric Hexter (@ehexter): what do MVC and Web Forms look like on OWIN. Louis says there are two exciting things there – you can have an Owin pipeline running in front of your application, or you can use self hosting to put an application inside of your own process (not supported but fun!).

Show Links: