I am using Sequential workflow which is hosted by application.

As recommneded by you people in your various blogs and posts to use the ManualWorkflowSchedulerService, i did same everything was going very fine with it but during load testing we found that messages of different users get swapped when 8-10 peoples submit their requests simultaneously. The DB is showing the correct results but the messages are not, as i am preparing the output object at complete event of the workflow and the object scope is limited to this event too.

if anyone may help & clear me the cause of problem.

Thanks in anticipation.

Sobia Meghani.

Re: Windows Workflow Foundation Messages get swapped in complete event of workflow...

Tom Lake - MSFT

Can you explain your application a little more What activities are in your workflow and what does it do What DB is showing correct results and how do you know it is correct What messages are you talking about and how do you know they aren't correct

Re: Windows Workflow Foundation Messages get swapped in complete event of workflow...


Thanks for the response Tom.

The flow of information is:

1. application lets user to make a requisition from a web page.

2. On request submission it passes the necessary information to the hosting layer; which is serving as an intermediator in between workflow and application and in actual it prepares the wf parameters, instantiate the workflow and pass the parameters to it.

3. Workflow firstly get the ruleset from the database which is already in XAML (we are making it by using codeDom assembly and save into DB against some entitiy but this is another part of application), it makes avaliable that extracted ruleset to the custom policy activity (whose inpiration is taken from ExternalRulesetLibrary sample ( There are few more activites which are responsible for emailing and executing some default actions. The request status is updated in the DB according to the ruleset

4. In this process within the workflow, we are setting some output parameters whcih are responsible to show the resultant response from the workflow.

5. There is an output object which is prepared at the complete or terminate events of the workflow at the hosting layer.

6. This output object is return back to the application which examine it and shows the response messages which are creating problem in actual as I mentioned these messages are get swapped when simultaneously many users submit request.

We are updating the request status at the UI which is taken from DB and updated by the workflow in the DB and that result is fine.

The runtime is started at the application variable and services are added into the runtime at the same level at the Global.asax file as recommended in different samples and posts at the forum. Also I am adding the MnaualSchedulerService and updating it when it returns back the control to the hosting layer.

Our findings:

On careful examination we found that when we are sending the requests in sequential order one by one in the loop, it is working fine but on invoking the multiple threads simultaneously i.e. 5 requests in individual threads, it process the first coming thread as usual but giving error on other threads and also missing the parameters at the workflow end, guess it is missing the context.

Please let me know the cause of problem or if i have miss something or misused something in the above mentioned scenario.

Thanks in anticipation.


Sobia Meghani.

Re: Windows Workflow Foundation Messages get swapped in complete event of workflow...

Andrei Romanenko - MSFT


Can you please share your hosting layer code, including following parts: where workflow runtime created and configured, threading service setup, workflow executed, and completion events handled This will help undestand the problem better.