LinkedIn

Tuesday, 5 October 2010

Why does my workflow die when I add a TransactedReceiveActivity?

dzien dobry,


I dont know the answer to this one but hopefully I will be able to update this post when I find out. 


The issue is this:
When I add a TransactedReceiveScope to a fully functional, persisted workflow monitored by AppFabric the workflow throws an exception.


I have looked at the exception and my trace / log files and can't find any useful information.


My Workflow looks like this:


And the error is this:



The error text is:
The execution of the InstancePersistenceCommand named {urn:schemas-microsoft-com:System.Activities.Persistence/command}LoadWorkflow was interrupted by an error.

And the stack trace is:
Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at WindowsClient.ExpenseServiceRef.IExpenseService.EndGetData(IAsyncResult result)
   at WindowsClient.ExpenseServiceRef.ExpenseServiceClient.WindowsClient.ExpenseServiceRef.IExpenseService.EndGetData(IAsyncResult result) in C:\PROJECTS\TelerealTrillium.Expense.Workflow.Soln\TelerealTrillium.Expense.Workflow.Soln\WindowsClient\Service References\ExpenseServiceRef\Reference.cs:line 532
   at WindowsClient.ExpenseServiceRef.ExpenseServiceClient.EndGetData(IAsyncResult result) in C:\PROJECTS\TelerealTrillium.Expense.Workflow.Soln\TelerealTrillium.Expense.Workflow.Soln\WindowsClient\Service References\ExpenseServiceRef\Reference.cs:line 537
   at WindowsClient.Form1.OnStartCompleted(IAsyncResult asr) in C:\PROJECTS\TelerealTrillium.Expense.Workflow.Soln\TelerealTrillium.Expense.Workflow.Soln\WindowsClient\Form1.cs:line 93

Ill keep hunting for solution and will post back when I find it.


========================== Time passes =========================


Ok so I came back to this little issue after remembering about the MSDTC. 
I realized that my app. updates my persistence store AND my custom expense database inside the TransactedReceiveActivity. (I update my custom expense database using Entity Framework 4.0)


Now my connection strings for these 2 things are different obviously so I am trying to wrap a transaction around some activities that span 2 databases.






So what I did first was enable MSDTC on my local server that hosts my WCF Workflow 4.0.
It was like:
Now its like:
But that still didnt work. Although I did see a one off Transaction Aborted error which I can't reproduce.
I then went to my remote SQL server that hosts my Persistence store and custom Expense database which is what I should have looked at first really.

I enabled the same open-ish security on the Sql box and it fixed everything!! 





thanks
RuSs