title: Alternative to WorkflowServiceHost for WF4?
body: <p>We're looking to replace a chunk of our business logic with WF4 workflows.<br />
  They're all pretty typical workflows: User action creates an instance, database effort, next user confirms, etc.</p>
  
  <p>Our requirements for the workflow host are:</p>
  
  <ol>
  <li>Create workflows from XAML definitions stored in a database (DynamicActivity)</li>
  <li>Support workflows on different versions</li>
  <li>Support long time-based events (we're currently aware of notifications after 5 days and rolling back a workflow after 30 days)</li>
  <li>Support many instances of many workflows (we've identified 10 workflows with about 4000 in-flight, of which only a few are processing at any one time)</li>
  <li>Retain all state after a service restart (including the time-based event)</li>
  <li>Authenticate the calling user (WindowsAuthentication, if possible)</li>
  </ol>
  
  <p>As part of the migration effort, I built some POCs using "WCF Workflow Service Application" projects, but from what I can see these aren't immediately possible.</p>
  
  <p>I've got that #2 is done through WCF Routing, and my understanding is that WSH will handle #3 for us (is this true, given #5?), but I can't see how #1 would work from the default project structure.<br />
  I've solved #1 using WorkflowApplication instances, but this relied on using bookmarks to resume for each input event, and I wasn't convinced that WorkflowApplication would scale to our needs without unloading idle workflows, which breaks the Delay activity.</p>
  
  <p>So, if you've stuck with me this far:</p>
  
  <ul>
  <li>Is there a way to achieve all of this using WSH, either in the default project or by implementing some of it ourselves?</li>
  <li>Are we better off writing our own "DurableDelay" activity that records the true wake time and unloads the workflow to be resumed by the host process, given the long durations and potential need to unload and reload workflows?</li>
  <li>If WSH isn't going to do it, is there an existing alternative?</li>
  </ul>
  
  <p>I'm not averse to writing our own host service to handle workflow lifecycle, and we've even drawn up the proposed design, but I didn't want to start down that route if it turns out that there is a ready-made solution.</p>
  
  <p>Cheers</p>