R – Sql Workflow Persistence Service does not save workflow state

netpersistenceworkflow-foundation

Hallo everybody,

I'm dealing with a pretty strange situation here. I have developed a State Machine Workflow and it worked just fine until today.
Now, the Sql Workflow Persistence Service does not save the workflow state. There is no any exception, just it does not save the state. The flow is going normally to the Event Driven activity which is, by following this article link, one of the conditions when workflow state has to be saved (what it has been doing just fine before).

The configuration of Sql Workflow Persistence Service look like this:

     <workflowRuntime name="WorkfolwServiceHostRuntime" validateOnCreate="true"
        enablePerformanceCounters="true">
        <services>
          <add 
            type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, 
                System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, 
                PublicKeyToken=31bf3856ad364e35" 
             connectionString="Data Source=svr; 
               Initial Catalog=WorkflowPersistence; user id=User;password=Pass; 
               Trusted_Connection=False" LoadIntervalSeconds="1" 
               UnLoadOnIdle="true"/>
          
        </services>
      </workflowRuntime>

Maybe the problem is because there is one more application that hosts workflow runtime and uses the same workflow persistence database. I couldn't find any information if this is allowed or not.

I cant see any other reason why is this happening, so I will appreciate any suggestion.

Thanks

Best Answer

Normally the workflow is persisted when it becomes idle. How soon it gets persisted also depends upon factors such as the polling interval ( which you would have provided while creating the SQLPersistenceService and attaching it to the runtime.) Also Everything that the workflow uses, esp. The ExternalDataEvent args and the events should be marked as Serializable.

Regarding handling Exceptions, you should add FaultHandlersActivity to your workflow, and the exception that is caught, will be saved in the Fault property that gets exposed along with the FaultHandlersActivity.

Hope that's helpful.

Related Topic