Search code examples
asp.networkflowasp.net-3.5workflow-foundationworkflowservice

SqlTrackingQuery.GetWorkflows is not getting the correct workflows


I'm using ASP.NET 3.5 and WF 3.5.

The code I have is constantly giving me a FileNotFoundException. Even though I have created two workflow instances. It keeps trying to grab the first Workflow (and tells me the assembly is not there) and not the second workflow. This is my code:

Dim connectionString As String = ConfigurationManager.ConnectionStrings("LocalWFConnection").ConnectionString

    Dim trackingQuery As SqlTrackingQuery = New SqlTrackingQuery(connectionString)
    Dim options As SqlTrackingQueryOptions = New SqlTrackingQueryOptions()

    Dim workflws As IList(Of SqlTrackingWorkflowInstance)
    Try
        workflws = trackingQuery.GetWorkflows(options)

    Catch ex As SqlException

        workflowError = String.Format("A SQL exception occurred.  Details:<br />{0}", ex.Message)
        Return workflowData

    Catch ex As IO.FileNotFoundException

        workflowError = String.Format("File loading exception occurred. Details:<br />{0}", ex.Message)
        Return workflowData
    End Try

Solution

  • Dim trackingQuery As SqlTrackingQuery = New SqlTrackingQuery(connectionString)
    Dim options As SqlTrackingQueryOptions = New SqlTrackingQueryOptions()
    options.WorkflowType = GetType(Workflow1) ' where Workflow1 is the name of your Workflow