.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Workflow used with : WCF + Persistence + Tracking : how to manage ?

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :WPF


My question is simple : how to manage both all these technologies in the same project ?

Framework : Workflow 3.5 VS2008

What files are in the Workflow WCF Project :

- the interface for methods exposed.

- the Workflow C#.

- the app.config file.

What I already know how to do :

- Workflow WCF with SQL persistance and activate SQL Tracking

What I don't know how to do :

- Publish WCF methods in the same project for querying the tracking database (C# classes used : SqlTrackingQuery and SqlTrackingQueryOptions)

How to manage it ?

Thank you.

View Complete Post

More Related Resource Links

Architectural insight for a workflow persistence/tracking problem

I'm working for a client who has many (~200) SQL databases containing client information.  My client would like to store each of their customer's workflow persistence/tracking information within their respective database.  This is needed because the databases need to be portable so they can be moved from a client site to a hosted environment and vice versa.  They want to handle all of the workflow processing from a single Windows service.  My initial thought is that I'll need to rewrite the SqlWorkflowPersistenceSerivce and SqlTrackingService services to be able to handle this requirement.  This rewrite would include the ability to scan all of the databases on a periodic basis for workflow events that need to be processed.  This sounds like a bit of challenge, and I want to make sure that I'm not overlooking something simple.

Any expert opinions on this?
Matt Ruwe

Persistence not reloading workflow properly

To start with, some background on the project I'm working on. It's basically a todo list. I have a workflow with activities that will send a message to the UI layer to display a todo item to the user when that point in the workflow is reached. The todo activity is set up so that each time the activity context loads, it will send out a request to show the todo item if the activity is in executing status. This is a multiple host environment, so instance ownership is of interest during persistence (I use the SqlWorkflowPersistenceService). I originally was trying to set this to a max timespan. It works ok, except it relies on the closing of the application to call dispose on the workflow runtime in order to remove the ownership. If the application crashes, I have a manual "unlock workflow" functionality. That is a bit of a pain, so I thought I'd try a small ownership duration, but it's not working quite right. When I first load the workflow into the client, everything shows up fine. I have a refresh functionality that also works fine as long as the ownership duration hasn't been reached. Once it is reached, the todo item doesn't show up. I believe the workflow is not even loading from persistence. I've been testing it with a single runtime, so I know there are not any other runtimes taking ownership. Here is what I do during a refresh: for each workflow in run

Workflow persistence with a non-serializable variable

I'm using Entity Framework and WF4. I want to be able to persist a workflow but one of my variables in the workflow is an EF ObjectContext. Is there a way to make the workflow persist-able and when it re-hydrates, has a fancy new ObjectContext instance?Blades Don't Need Reloading...

workflow 4 correlation / persistence question

Hello all, I would like to understand why the following behavior takes place. In most cases my workflow that runs monthly account renewals works just fine. But with selected accounts it gets stuck. What I mean by stuck, is that a record is created in System.Activities.DurableInstancing.InstancesTable (in my persistence db), but IsInitialized remains to be set to 0 (so is IsSuspended, IsReadyToRun). When I step through my workflow, I see that the problematic accounts do not pass InitializeCorrelation activity (I pass an AccountID to initialize AccountIDHandle). What I can't figure out is  where InitializeCorrelation looks to determine if a flow with a given AccountID already runs? I killed all the instances of workflows in the database using DeleteInstance stored procedure, so InstancesTable has no rows. And yet the same problematic accounts trip over InitializeCorrelation activity - a new instance of a workflow will be created and stored in InstancesTable with IsInitialized = 0. Thank you very much, Andrei  

Where is the issue tracking workflow?

Hi All, Going through the out of the box workflows currently and I can't work out where the Issue tracking workflow would be found? Technet doco refers to both the three state and issue tracking as being separate workflows and that the issue tracking workflow is about we pages. http://technet.microsoft.com/en-us/library/cc263148.aspx#DefinedAgain  I can create an issues tracking list and add a three state workflow to that. Just trying to learn about the Issue Tracking workflow. Any ideas on where I can add or configure this workflow? Thanks, Gavin  

Windows Workflow Persistence Service using Oracle Database



We are using windows state machine workflow. We need to use Oracle for persisteing and tracking workflow instances. Can anyone provide custom services for Oracle?

We have even tried WFTools but not able to connect to Oracle database. Please provide the same code if anyone has tried.





Workflow in two sides : SQL Persistence in the WCF Service side + Workflow logic in the client side



I'm new in Windows Workflow Foundation 3.5, and I red some documentation.

Now, I would like to know if an architecture is possible in my case :

- WCF service with SQL Service access : put in it the Workflow SQL Persistence. I know that this part can be ok alone.

- Client side (ASP.Net) : put in it the Workflow logic. Ex : know when we are in a given state, and display icons and text related to this state, and know what is the next available step.

Is this architecture possible, and how to manage it in a few words ?


Windows Workflow Tracking User Data and fetching via SqlTrackingQueryOption


We are using WF in one of our application. We would like to track user data so that when we query via SqlTrackingQuery, we get the desired workflows only but the issue is that Activity.TrackData is not writing to the TrackingDataItem table instead it writes to the UserEvent table. When we use the SqlTrackingQueryOption and set the TrackingDataItems property it does not return any value as it makes a join to the TrackingDataItem table. This i have figured out by using Reflector.exe. Could u kindly tell us what we are doing wrong. We will be very gratefull.

P.S. I can also submit the code if requested.

Support for Oracle as Persistence-, Tracking and AppFabric-Monitoring-DB as a product


Hi all,

we did many large scale projetcs for international customers. Most of them use ORACLE in their database infrastructure. Hence our product must be able to use ORACLE as database backend. We are now working on extending our product in order to enable our customers creating, managing and running business processes. We would love to have this based on Workflow Foundation 4.0.

Unfortunately Microsoft offers only interfaces that we would have to implement for using an ORACLE database backend. We think that the implementation of these interfaces should be a product on its own -- done in professional development and providing professional support. In my opinion the acceptance of WF will depend highly on being able to support ORACLE custumers. No offense considering SQL Server, but most of our large scale customers will never agree to use a database infrastructure other than ORACLE.

Are there any plans to provide an implementation of these interfaces for ORACLE as a product by Microsoft or another vendor?

Best regards,



Workflow with id "xx" not found in state persistence store.


I have a state machine workflow having around 15 states. In few of the states I am using SqlWorkflowPersistenceService to persist the workflow instance into the database. Workflow is using WorkflowInstance.Unload() method to manually persist the workflow instance and UnloadOnIdle is set to false. Workflow service is hosted as WCF service on a windows service.

Problem: The states which implements SqlWorkflowPersistenceService to persist the wf instance calls another WCF service (which may take a lot of time) and then persists the instance. WCF service when finished with its processing responds the Workflow service by calling the operation contract associated with the Receive Activity in the next state of Workflow Service. Everything runs fine if the WCF service takes some time to respond the Workflow back. But sometimes it happens that WCF service has nothing to process and it responds immediately to the workflow, in this case workflow throws the error "Workflow with id “xxxxx” not found in state persistence store." 

What I think here is when WCF service reponds back to the WF immidiately then WF is still busy in persisting the WF instance. WF Runtime finds no wf instance in memory and checks into the persistance database. Since WF instance is still in the process o

Error while executing workflow persistence


I get the following error while running my workflow, on average of about 1 in 200 instances.

An error processing the current work item has caused the workflow to abort.  See the inner exception for details. InnerException Message: The execution of the InstancePersistenceCommand named {urn:schemas-microsoft-com:System.Activities.Persistence/command}SaveWorkflow was interrupted by an error.


An error processing the current work item has caused the workflow to abort.  See the inner exception for details. InnerException Message: The operation did not complete within the allotted timeout of 00:00:00. The time allotted to this operation may have been a portion of a longer timeout.

The problem seems to be with persistence not happening within 0 seconds, but I wouldn't have a clue where i can increase this???  Remember that this workflow normally runs fine????

Jason Bolstad

Workflow - CodeActivity and Persistence



 I want to know is there any mechanism/configuration that the persisted workflow instance can resume a code activity from where the lat unloading happened?

Eg: I have a code activity which is long running code and meanwhile I will unload the instance if any service shutdown happened. Now how can i resume/restart the same code activity on loading the workflow?


SQL Tracking Service XAML only (Type, Workflow and Activity db tables)


Ok, we've implemented workflow completely into our system now and I've starting to see the tracking database grow fairly quickly, which was expected


I am now working on a purge routine and or partitioning.


What I have noticed is that the Workflow and Type db tables will constantly grow no matter what.  They are not considered "partitioned" tables.


My main question is the architectural decision around this XAML only approach of tracking versus the code behind\beside approach.  I have a hypothesis I will present below.


In code behind\beside.


Free Series of SharePoint Workflow How-to Videos

This is the series of "How to" Document Workflow with SharePoint using Visual Studio 2008 (using the .NET Framework 3.0 for backward compatibility to Visual Studio 2005). I have created video's that show the most common requests that I have seen around MOSS/SharePoint 2007 workflow & document workflow.

Workflow Services: Visual Design of Workflows with WCF and WF 4


The .NET Framework 4 makes it easier than ever to implement WCF services using WF. We'll demonstrate just how easy it is by modeling a long-running, durable and instrumented workflow based on a real-world business case without having to write any code.

Leon Welicki

MSDN Magazine May 2010

Workflow Essentials: Collaborative Workflow Improvements in SharePoint 2010


In this article, the author covers the new features in SharePoint 2010 geared for workflow developers and then walks the reader through a couple of new user scenarios.

Paul Andrew

MSDN Magazine November 2009

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend