October 2009 - Posts

WF 4.0 beta 2 making persistence work
Tue, Oct 27 2009 7:56 PM

WF & WCF beta 2 samples contains some samples to work with WF persistence.

  1. OOB this is not working. What do you have to do to make it work:

    Navigate to the .NET Framework 4.0 directory (C:\WINDOWS\Microsoft.NET\Framework\v4.0.21006)
  2. Open WorkflowManagementService.exe.config in visual studio
  3. Add a database to the configuration like:
    <databases>
         <database connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=DefaultSampleStore;Integrated Security=True;Asynchronous Processing=True"/>
     </databases>
  4. Make sure that the WorkflowManagementService is added as a windows service. The setup.cmd of sample DurableDelay does this for you. 

Samples like BuiltInConfiguration & DurableDelay do work now. (the connectionstrings in both the application and configured in WorkflowManagementService.exe.config must be the same)
In workflow 3.X the SqlWorkflowPersistenceService polls the database. Now WorkflowManagementService.exe is polling this database and when it's time to continue the workflow it notifies the workflow application.

It's much nicer to see the power of persistent workflows when you add a something like:

Console.WriteLine("Hit any key to start a workflow instance");
Console.ReadLine();

just before the proxy.start() call.

When you start a workflow for the first time you hit any key to start a workflow instance. While the application is running just kill the application. Start it up again. Now because only the servicehost is started, the application will continue the interrupted workflow.

download the WF & WCF Samples for WF 4.0 beta 2: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=35ec8682-d5fd-4bc3-a51a-d8ad115a8792

by Pascal Naber | with no comments
Filed under: