Host Wf in WCf RRS feed

  • Question

  • Hi all

    using .NEt 4.0 beta2.  Wf 4 beta 2 and WCF 4 beta 2

    I am new to workflow. I gave a WCf service which exposes few methods. the methods in WCf invoke WF. I am trying to host WF in WCF.

    Inside the Wcf method i said, WorkflowInvoker.Invoke(new ActivityX());

    I also instantiated WorkflowRuntime and called StartRuntime. nothing worked

    Am I doing it right?
    • Moved by Andrew_Zhu Wednesday, November 25, 2009 5:22 AM (From:Windows Workflow Foundation)
    Wednesday, November 25, 2009 12:35 AM


  • Hi ChandraSekhar,

    There are multiple ways that you can integrate WF with WCF:

    1) Write a WCF WF Service application, and use Receive Activity create a WCF service, anything in the application is created by WF.
    2) Call System.Activities.WorkflowInvoker.Invoke() in WCF method as you mentioned. This should work, if it's not working, could you please post your code?
    3) Instantiate System.Activities.WorkflowApplication and call application.Run(). This provide richer functionaility than WorkflowInvoker.

    btw, WorkflowRuntime is in namespace System.Workflow, which is WF 3.0 and 3.5 class (though you can still see it in .Net 4 because lagecy application support). WF 4.0 is under namespace System.Activities, there is no need to initialize runtime in WF 4.0

    Wednesday, November 25, 2009 9:07 AM