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.
[746 byte] By [MikaelN] at [2007-12-17]
# 1
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
JamesConard at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2
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?
MikaelN at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3
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);
}

ArjunBanker at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4
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?
MikaelN at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5
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.
sravula at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 6
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.
MikaelN at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 7
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
Ranjan at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 8
Does this mean that persistense services cannot use SQL Server 2000 (or later)?
AlekDavis at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 9
Hi Alek,
SqlPersistence Service can be used with Sql2000, MSDE or SQLExpress. What is the problem you encountered using the service..
Thanks,
Srikanth.
sravula at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 10
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.
sravula at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 11
Srikanth, no, I have not seen any problem, yet (has not yet used the feature). I was just alarmed by Ranjan's post.
AlekDavis at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 12
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.
Oussou at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 13
What is your environment like? What are your regional settings?

Thanks, Iza

Iza at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 14
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?
ZhuangYicheng at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified