Hi,
I've tried to created a web application using workflow. but there was an exception (array index out of bound exception) occurred when i tried to call 'startRuntime()'. Here is the code:
---------------------------------------------------------------------
private
WorkflowRuntime runtime; private WorkflowInstance instance; private AutoResetEvent waitHandle;and in button_click():
runtime =
new WorkflowRuntime();waitHandle =
new AutoResetEvent(false); SqlWorkflowPersistenceService sqlService = runtime.GetService<SqlWorkflowPersistenceService>(); if (sqlService == null){
NameValueCollection persistenceParams = new NameValueCollection();persistenceParams[
"UnloadOnIdle"] = bool.TrueString;persistenceParams[
"ConnectionString"] = connString;sqlService =
new SqlWorkflowPersistenceService(persistenceParams);runtime.AddService(sqlService);
}
ExternalDataExchangeService dataService = new ExternalDataExchangeService();runtime.AddService(dataService);
ExpenseApprovalService dataExchange = new ExpenseApprovalService();dataService.AddService(dataExchange);
ManualWorkflowSchedulerService scheduler = new ManualWorkflowSchedulerService();runtime.AddService(scheduler);
try{
runtime.StartRuntime();
}
catch { } --->catch an array index out of bound exceptionruntime.WorkflowIdled +=
new EventHandler<WorkflowEventArgs>(runtime_WorkflowIdled);runtime.WorkflowCompleted +=
new EventHandler<WorkflowCompletedEventArgs>(runtime_WorkflowCompleted); ----------------------------------------------------the exception only occurs if I add the "SqlWorkflowPersistenceService " to the workflow.
Can anyone please help me with it
cheers,
sydney

SqlWorkflowPersistenceService exception using beta2
shaufe
Thanks Matt for your reply.
I've changed my code to use WorkflowWebRequestContext. But true it is not quite related to the problem. I was able to fix the problem by re-creating the database for SqlWorkflowpersistenceService. But I went into situation that the problem may come back eventually. Then I have to delete and re-create the database again. Anybody has any idea of why
cheers,
sydney
esteves_plk
aimnmhmd
Rodrigo Diaz
The issue is probably more likely related to the fact that your workflow assembly is not strong named, so version numbers don't really matter a whole lot. When loading an assembly, .NET generally only looks at the version number for a strong named assembly.
Matt
raj mishra
Chris_Guzak
Joel Leavitt
If you are using this in a web application, you should look at using the WorkflowWebRequestContext, the workflow http module, and web.config to manage the runtime and configuration of your services. This provides a more manageable mechanism for dealing with the runtime and is the recommended approach in asp.net apps.
Sounds like your problem was unrelated to that, but it might make for less code in your application.
Matt
sivakishore
Are you changing the version number on your workflow, or just changing the existing version It seems like that will definitely cause problems if you have inconsistencies when the workflow runtime tries to deserialize your old instance.
Matt