Problems with state persistence and timer services

Hi, I've experimented with adding the SQL state, timer and tracking services to the Lab1 sample step 4 (the expense report approval workflow). The tracking service works fine, but it seems that the state and timer services get the engine stuck on the ListenForManagerApproval activity. If I disable the state and timer services the workflow unfolds as expected.

I use the (really cool) Workflow Monitor sample to view the results, and the progress is evident every time: With the state and/or timer service enabled, the flow gets stuck on ListenForManagerApproval  and then after a while the workflow gets the status "aborted".

Any ideas why this happens The databases are perfectly OK and initialized using the provided scripts.



Answer this question

Problems with state persistence and timer services

  • ethan23m

    The services were added as follows:

            private void StartWorkflowHost()
            {
                // Create a new Workflow Runtime
                workflowRuntime = new WorkflowRuntime();

                SqlStatePersistenceService statePersistence = new SqlStatePersistenceService(
    connstr);
                workflowRuntime.AddService(statePersistence);
                SqlTrackingService tracking = new SqlTrackingService(
    connstr);
                workflowRuntime.AddService(tracking);

                // Start the Workflow services
                workflowRuntime.StartRuntime();
    ...

    The tracking service works just fine, but the state service fails as described in previous posts. But good to hear that it works for you, then it's probably just something with my installation, and I'll try reinstalling at some later point. Thanks.

  • vonWinter

    Does this mean that persistense services cannot use SQL Server 2000 (or later)
  • xPLaR

    Great idea, but the flow never gets to that stage. I get a WorkflowAborted event but never a WorkflowTerminated event, and the WorkflowAborted event does not give a reason, just a normal WorkflowEventArgs object.

    But thanks for the suggestion. Btw. the last activity (ListenForManagerApproval) is marked as Executing in the monitor.

    Do the services work for you

  • dimwit

    Can you add a terminated handler and examine the reason for the failure

    In Main(), add

    workflowRuntime.WorkflowTerminated += new EventHandler<WorkflowTerminatedEventArgs>(workflowRuntime_WorkflowTerminated);
    ...

    and,

    static void workflowRuntime_WorkflowTerminated(object sender, WorkflowTerminatedEventArgs e)
    {
       Console.WriteLine(e.Reason);
    }


  • Pgr

    I think the issue might be just with the SQL Timer Service.  Does it work if you disable just the SQLTimerService and leave the SQLStatePersistenceService enabled


    James Conard
    Architect Evangelist - Windows Workflow Foundation
    http://www.WindowsWorkflow.net
    http://blogs.msdn.com/jamescon



  • Ravenbutterfly

    Hi Alek,
          SqlPersistence Service can be used with Sql2000, MSDE or SQLExpress. What is the problem you encountered using the service..
    Thanks,
    Srikanth.

  • HypeH

    I have encountered the same problem: the sqltrackingservice works well, but the sqlstatepersistence doesn't work.
    My environment: visual studio 2005 beta2, windows workflow foundation beta1, sql server 2000, windows xp professional.
    is it for the sql server 2000

  • SanjayAgrawal

    Hi Mikael,
        We did not hear from you for some time regarding the issue. Were you able to resolve it. If you still have problem do let us and we will be glad to help.
    Thanks,
    Srikanth.

  • Joccar

    Nope, I've tried both combinations, i.e. only the timer service and only the state service, and the result is the same, the workflow is aborted immediately after the ListenForManagerApproval activity. Also, nothing is ever written to either the timer or state tables.

    Btw. has anybody else encountered this problem

  • Fuhrer

    Srikanth, no, I have not seen any problem, yet (has not yet used the feature). I was just alarmed by Ranjan's post.
  • mofo7

    Hi Mikael, 
          If the last activity is marked as executing and the workflow is aborted then most likely you do not have persistence service.Try adding the persistence service now and see if it works. The sample works fine for us.
    Thanks,
    Srikanth.

  • xrayb

    Well I have the same problem Micheal has.... Anyone has a clue what's going on Seems like the SqlStateTracking is working but neither SqlStatePersistence nor SqlTimerSevice seems to be working on SQL 2000. Seems like I'm not the only onewith this problem.

  • BogN

    Hi, are you by any chance using SQL Server 2000, because if you are this wont work. I had the same problem i switched from 2000 to Express and it worked fine
  • HeHeHeHeHeHe

    What is your environment like What are your regional settings

    Thanks, Iza

  • Problems with state persistence and timer services