ASP.NET and SqlWorkflowPersistence problem

Hi,

I got a problem when using workflow in ASP.NET. I downloaded the ASP.NET workflow sample from the site and added the WorkflowRuntime.Addservice( new SqlTrackingService(constr) ) and SqlWorkflowPersistence.

When I ran the application, it returns an error stating that I cannot add those services when the workflow runtime is stared...

please help.




Answer this question

ASP.NET and SqlWorkflowPersistence problem

  • tzucc

    Are you using Beta2 I will recommend you to switch to Beta 2.2.

    However there are some issues in beta2.2 in hosting workflows in ASP.NET. Check this blog for details
    http://blogs.msdn.com/pandrew/archive/2006/04/28/586181.aspx

    and this blog for a sample
    http://blogs.msdn.com/tomlake/archive/2006/05/02/588617.aspx

    HTH,
    Sonali



  • lldonn

    You should add the services before StartRuntime method is called. For ASP.NET application you can add the services in the web.config in WorkflowRuntime Section

     

    < xml version="1.0" >

    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

      <configSections>

        <section name="WorkflowRuntime" type="System.Workflow.Runtime.Configuration.WorkflowRuntimeSection, System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

      </configSections>

      <appSettings/>

      <connectionStrings/>

      <system.web>

        <authentication mode="Windows"/>

        <compilation debug="true">

          <assemblies>

            <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

            <add assembly="System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

            <add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

            <add assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

            <add assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

            <add assembly="System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

            <add assembly="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

            <add assembly="System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

            <add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

            <add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

            <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

            <add assembly="Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

            <add assembly="Microsoft.Build.Framework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

          </assemblies>

        </compilation>

      </system.web>

      <WorkflowRuntime Name="WorkflowServiceContainer">

        <Services>

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

          <add type="System.Workflow.Activities.ExternalDataExchangeService, System.Workflow.Activities, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
         <add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" ConnectionString="Initial Catalog=WorkflowStore;Data Source=localhost;Integrated Security=SSPI;" LoadIntervalSeconds="2" UnloadOnIdle="true" />
        <add type="System.Workflow.Runtime.Tracking.SqlTrackingService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" ConnectionString="Initial Catalog=WorkflowTracking;Data Source=localhost;Integrated Security=SSPI;" />
    </Services>
     </WorkflowRuntime>
    </configuration>

     



  • ANSHUL VIJH

    WorkflowWebRequestContext.Current.WorkflowRuntime has been removed starting with Beta 2.2.  The samples that I have on my blog, Sonali gave you a link, use the Application State object to store the runtime.  I posted a new samples today that use the Sql persistence and tracking services with a Xoml activated State Machine Workflow with Beta 2.2.  One sample uses a shared database and the other separate databases. I included the scripts needed for creating the databases.

  • Mark Michaelis

    But my sample ASP.NET code does not explicitly invoke the StartRuntime() method of the workflow runtime instance. It uses the WorkflowWebRequestContext.Current.WorkflowRuntime instead.

    I also incorporated the web.config code in your reply in my web.config project, but still the proble/error persists.

    Please help.



  • ASP.NET and SqlWorkflowPersistence problem