WorkflowWebRequestContext.Current always returns null

Hi,

Why does WorkflowWebRequestContext.Current always return null, and when I create a new instance of WorkflowRuntime i get the error saying that you cannot create more than one instance per appDomain




Answer this question

WorkflowWebRequestContext.Current always returns null

  • gshaf

    Check to make sure you have this line in your web.config

    <httpModules>

    <add type="System.Workflow.Runtime.Hosting.WorkflowWebHostingModule, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="WorkflowHost"/>

    </httpModules>

    The WorkflowWebRequestContext.Current.WorkflowRuntime - is established from the http handler (above).

    For e.g. you should be able to grab a non-null reference to it from within the App_Start - event within Global.ASAX.

    So by the time your workflow runs, you should well and truly have a reference.

    Are you exposing your WF as a Web.Service

    Also - ******* if you use the ManualWorkflowSchedulerService ***** make sure you call the RunWorkflow(...) method from it!!!!! (after you RaiseEvents etc. etc.)

    Let me know how you go.



  • WorkflowWebRequestContext.Current always returns null