locked
Persistence does not work for the second ReceiveAndSendReply activity RRS feed

  • Question

  • Hi all,
    I am new in Workflow 4. I don't know whether the way I code is the right way or not. I have developed a XAMLX workflow service with two ReceiveAndSendReply activity placed in serial. Both of them are correlated with an Int32 ID. What I am trying to do here is to have the first ReceiveAndSendReply to receive a request (data) from user and then the second ReceiveAndSendReply is waiting for an action from another user for approval.

    I have tested it with the WCF Test Client without persistence setting and it works well.
    But when I configure the PersistenceProvider to SQL database, the first ReceiveAndSendReply activity does insert a row to the Instances table in database, but second ReceiveAndSendReply activity fails to do that. The settings in my web.config is as below:
      <system.serviceModel>
        <services>
          <service name="UpdatePartyService" behaviorConfiguration="FlowChart.PartyMaintenanceService.UpdatePartyServiceBehavior" >
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
            <endpoint name="UpdatePartyService" address="" binding="basicHttpBinding" contract="UpdatePartyServiceContract" />
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="FlowChart.PartyMaintenanceService.UpdatePartyServiceBehavior">
    
              <serviceDebug includeExceptionDetailInFaults="False" />
              <serviceMetadata httpGetEnabled="True"/>
              <persistenceProvider 
                type="System.ServiceModel.Persistence.SqlPersistenceProviderFactory, System.WorkflowServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                connectionStringName="PersistenceStore" 
                persistenceOperationTimeout="00:00:10" 
                lockTimeout="00:01:00" 
                serializeAsText="true" 
                canUseKeys="true" />
                <unloadInstance idleTimeout="00:00:01" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
      <connectionStrings>
        <add name="PersistenceStore" connectionString="Data Source=localhost\SQL2008;Initial Catalog=WorkflowPersistence;Integrated Security=True;Asynchronous Processing=True"/>
      </connectionStrings>
    Anybody can help me on this?
    Thank you very much.

    Tuesday, October 20, 2009 1:14 AM

Answers

  • The persistence model for workflow changed a bit in Beta2. A new persistence api was created to satisfy the unique requirements of workflow. SqlWorkflowInstanceStore and InstanceStore replace the SqlPersistenceProviderFactory and PersistenceProviderFactory.

    In order to set up a persistent database, you need to run the below 2 scripts under C:\Windows\Microsoft.NET\Framework\<current version>\sql\en. 
    SqlPersistenceProviderSchema.sql
    SqlPersistenceProviderLogic.sql

    You might want to take a look at the sdk sample "Durable Duplex" (http://msdn.microsoft.com/en-us/library/ee662960(VS.100).aspx), which illustrates a sample scenario of using Persistent in xamlx services.



    This posting is provided "AS IS" and confers no rights or warranties.

    • Proposed as answer by Leo.Chen Thursday, November 5, 2009 3:52 AM
    • Marked as answer by Panda Wang Saturday, May 22, 2010 7:59 AM
    Friday, October 30, 2009 11:47 PM

All replies

  • Hi,
    Can anyone help?
    Thanks.
    Wednesday, October 21, 2009 2:12 AM
  • Does configuring a sqlWorkflowInstanceStore work?


    				<behavior>
    					<serviceDebug includeExceptionDetailInFaults="True"/>
    					<sqlWorkflowInstanceStore connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=DefaultSampleStore;Integrated Security=True"/>
    				</behavior>
    


    Best Regards,

    Leo

    This posting is provided "AS IS" and confers no rights or warranties.


    Wednesday, October 28, 2009 8:36 AM
  • The persistence model for workflow changed a bit in Beta2. A new persistence api was created to satisfy the unique requirements of workflow. SqlWorkflowInstanceStore and InstanceStore replace the SqlPersistenceProviderFactory and PersistenceProviderFactory. 

    In order to set up a persistent database, you need to run the below 2 scripts under C:\Windows\Microsoft.NET\Framework\<current version>\sql\en. 
  • SqlPersistenceProviderSchema.sql
  • SqlPersistenceProviderLogic.sql

    You might want to take a look at the sdk sample "Durable Duplex" (http://msdn.microsoft.com/en-us/library/ee662960(VS.100).aspx), which illustrates a sample scenario of using Persist Activity in xamlx services. 
Friday, October 30, 2009 11:45 PM
  • The persistence model for workflow changed a bit in Beta2. A new persistence api was created to satisfy the unique requirements of workflow. SqlWorkflowInstanceStore and InstanceStore replace the SqlPersistenceProviderFactory and PersistenceProviderFactory.

    In order to set up a persistent database, you need to run the below 2 scripts under C:\Windows\Microsoft.NET\Framework\<current version>\sql\en. 
    SqlPersistenceProviderSchema.sql
    SqlPersistenceProviderLogic.sql

    You might want to take a look at the sdk sample "Durable Duplex" (http://msdn.microsoft.com/en-us/library/ee662960(VS.100).aspx), which illustrates a sample scenario of using Persistent in xamlx services.



    This posting is provided "AS IS" and confers no rights or warranties.

    • Proposed as answer by Leo.Chen Thursday, November 5, 2009 3:52 AM
    • Marked as answer by Panda Wang Saturday, May 22, 2010 7:59 AM
    Friday, October 30, 2009 11:47 PM