Basic WIndows Workflows 4 Persistance in a webserver hosted .xamlx services not working

272 views Asked by At

I'm trying to create a Windows Workflow 4 Service hosted in IIS. I've configured the service as below

<system.serviceModel>
    <services>
        <service name="ApprovalService" behaviorConfiguration="ApprovalServiceBehavior">
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="ApprovalServiceBehavior">
                <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                <serviceMetadata httpGetEnabled="true" />
                <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                <serviceDebug includeExceptionDetailInFaults="false" />
                <sqlWorkflowInstanceStore connectionStringName="WorkflowPersistence" />
                <workflowIdle timeToPersist="0" timeToUnload="0:05:0"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

The service does not persist! There's nothing magical in the service like custom persisting of values, etc. I've got it working in another service that does have a custom persistance method, but I can't figure out the difference.

Perhaps my service is erroring out, but I can not seem to figure out how to step into debugging either.

Any help would be greatly appreciated!

1

There are 1 answers

2
Maurice On BEST ANSWER

Assuming the name of your service element and the SQL connection string are correct you workflow should persist as soon as it goes idle. Did you try adding a Delay activity to ensure it goes idle or a Persist activity to force it to persist?

Try adding tracking or tracing to see what is going on. Something like

<system.diagnostics>
  <sources>
    <source name="System.Activities"
            switchValue="Verbose">
      <listeners>
        <add name="textListener"
             type="System.Diagnostics.TextWriterTraceListener"
             initializeData="MyTraceLog.txt"
             traceOutputOptions="ProcessId, DateTime" />
      </listeners>
    </source>
  </sources>
</system.diagnostics>