At work we're considering the future of one of our Windows applications. It's almost in sight of the technical cliff, where years of changes in an aging technology are making it so hard to maintain that a re-write is feasible.
We'd like its next incarnation to be as a SAAS web app, for the usual reasons: easy licensing and upgrades, and because it's more interesting to write. It would also give us the opportunity to offer some killer new features that just aren't possible currently. But there's a major hurdle: some customers need to be able to use it offline. If we can't come up with a way to run our shiny web app completely offline, it's back to rich client land for us.
We're a .NET shop, and despite my gentle nudging, I can't see us switching to node.js (or clojure!) any time soon. Up until recently, .NET web apps essentially had IIS as a prerequisite. That makes selling self-hostable web apps a nightmare to support. At my previous job, a large percentage of support tasks for our IIS-based app were due entirely to mis-configured IIS instances. And that was a product aimed at programmers - I can't imagine the nightmare it would be trying to walk regular users through it.
There is some hope though, in the form of OWIN - the Open Web Interface for .NET. It's a standard proposed by .NET community members, which Microsoft have embraced in a big way. Essentially, it specifies common interfaces between different layers of the web tech stack, allowing the parts to be swapped in and out. This means, for instance, that you no longer need IIS underneath ASP.NET MVC - you can host another HTTP server, eg HTTPListener in your own executable. OWIN is specified in such as way that you can often swap components in and out without needing to recompile your appllication.
Of course, if you're from the Ruby, Python or node.js worlds, this sounds pretty basic. Rack, WSGI and Connect have been providing what OWIN does for a while now. There's another option that OWIN opens up though the may be .NET specific: easily encapsulating the web server and browser into a single native application.
OWIN allows you to host your web stack in any old .NET executable - so I tried it in a WPF app. It worked just fine. Then, I embedded Chromium into the WPF app, and pointed it at the localhost URL of the hosted webserver. Bingo! A single, deployable, offline-capable app that still uses modern web technology. Best of all though, the web application logic can also be hosted, completely unchanged, in a console application that could run as a service on a Windows server. Or (though I haven't tried this yet), on IIS. Literally all that needs to change is the host wrapper, although obviously in a real-world application, some code paths would be disabled when running in stand-alone vs SAAS mode.
So that's the "what". The next post will give a bit more of a technical background on OWIN and related things, as well as showing how to hook it all up. If you want to jump ahead, there's some rough demo code over on BitBucket.