locked
How to do Dynamic Update of persisted workflow instance when using the WCF Workflow Service RRS feed

  • Question

  • I'm using the WCF Workflow Service to persist the workflow instance and it is working perfectly.

    PROBLEM:

    As when I change the workflow definition (Changes in Flowchart/ State Machine) then the Old Persisted workflow instance doesn't work..

    I had tried following the below link for dynamic update of the persisted workflow instance

    "http://msdn.microsoft.com/en-us/library/hh314052.aspx"

    But as you can see the problem is all the solution are around Workflow Application and not around WCF Workflow Service.

    So, can you please help me to show the steps "how to update the persisted workflow instance in WCF WORKFLOW SERVICE"?

    I would really appreciate as I had tried reading lots of articles and blogs but couldn't got any help.

    Thanks,

    Harry 




    Thursday, September 4, 2014 7:47 PM

All replies

  • Friday, September 5, 2014 9:42 AM
  • Hi Birdsven,

    Thanks for the reply but the link that you had sent is for the workflow application using 'XAML' file. I want to know how to do dynamic update for the WCF Workflow application using 'XAMLX' file. So let me know if you have any information about it.

    Friday, September 5, 2014 2:32 PM
  • Hi Birdsven,

    Thanks for the reply but the link that you had sent is for the workflow application using 'XAML' file. I want to know how to do dynamic update for the WCF Workflow application using 'XAMLX' file. So let me know if you have any information about it.

    I would also like to see an example for Workflow Service. Have you obtained any? thanks.
    Thursday, October 23, 2014 6:41 AM
  • Hi Birdsven,

    How are you hosting your workflow service? Are you using IIS/ASP.NET, or are you self-hosting by creating the WorkflowServiceHost object yourself?

    How are you making updates to the workflow definition? Are you doing it in code, or are you using the Visual Studio-based Workflow Designer, or are you re-hosting the Workflow Designer?

    Are you using the WorkflowIdentity introduced in .NET 4.5 to define the version of our "V1" of your workflow definition when the instances are persisted?

    Are you using SqlWorkflowInstanceStore to persist your workflow instances?

    Jim

    Monday, October 27, 2014 6:09 PM
  • I have the same problem.Do you reslove the problem?
    Monday, March 23, 2015 9:46 AM
  • Iptian,

    For your scenario, can you please answer the same questions:

    How are you hosting your workflow service? Are you using IIS/ASP.NET, or are you self-hosting by creating the WorkflowServiceHost object yourself?

    How are you making updates to the workflow definition? Are you doing it in code, or are you using the Visual Studio-based Workflow Designer, or are you re-hosting the Workflow Designer?

    Are you using the WorkflowIdentity introduced in .NET 4.5 to define the version of our "V1" of your workflow definition when the instances are persisted?

    Are you using SqlWorkflowInstanceStore to persist your workflow instances?

    Jim

    Tuesday, March 24, 2015 4:26 PM
  • Hi Jim

    I found a sample in the below link.
    WF4.5 Developer Preview - C# Expression, Workflow Versioning and Dynamic Update

    #1-#18 gone well.

    But #19,  We have encountered an error.

     public ActionResult ApplyUpdate(Guid id)
            {
                var workflowDefinition = (from wd in db.WorkflowDefinitions
                                          select wd).WithMax(wd => wd.IdentityVersion);
                controlClient.Update(id,
                    new WorkflowIdentity(workflowDefinition.IdentityName,
                        new Version(workflowDefinition.IdentityVersion.ToString("f1")),
                        workflowDefinition.IdentityPackage));

                return RedirectToAction("Index");
            }

    When call controlClient.Update,a exception occurs

    System.ServiceModel.FaultException was unhandled by user code
      HResult=-2146233087
      Message=A value of the wrong type was retrieved from the instance store.  A value of type {/workflow/}ExpenseRequestWorkflowService.xamlx was expected, but a value of type {/Contoso.Workflow/}ExpenseRequestWorkflowService.xamlx was encountered instead.
      Source=mscorlib
      StackTrace:
        Server stack trace:
           at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
           at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
           at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(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 System.ServiceModel.Activities.IWorkflowUpdateableInstanceManagement.Update(Guid instanceId, WorkflowIdentity updatedDefinitionIdentity)
           at System.ServiceModel.Activities.WorkflowUpdateableControlClient.Update(Guid instanceId, WorkflowIdentity updatedDefinitionIdentity)
           at Contoso.Web.Controllers.ManagementController.ApplyUpdate(Guid id) in c:\workflow1\WF4.5 Developer Preview - C# Expression, Workflow Versioning and Dynamic Update\C#\Contoso.Web\Controllers\ManagementController.cs:line 74
           at lambda_method(Closure , ControllerBase , Object[] )
           at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
           at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
           at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
           at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41()
           at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
           at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
           at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
           at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33()
           at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()
      InnerException:

    Can you help me?

    Thursday, March 26, 2015 3:54 AM