2011-04-20 2 views
1

Workflow Foundation 3.5에서는 SqlTrackingService를 사용하여 데이터를 추적 할 수 있지만 WF에서는 작동하지 않습니다. 사용하려고하면 SqlTrackingService가 워크 플로 또는 활동 이벤트를 catch하지 않습니다.SqlTrackingService가 WF 4.0에서 작동하지 않는 이유는 무엇입니까?

사용자 지정 추적 서비스를 작성하지 않고 WF 4.0에서 SqlTrackingService를 구성 할 수있는 방법이 있습니까? 그 My3Activity를해야한다주의,

WF3.5은 (완벽하게 작동합니다 : 요점은 내가

여기 두 가지 예합니다 (MS 샘플에서 WorkflowMonitor 같은) 가능한 한 많은 기본 제공 도구를 사용하고자하는 것입니다

namespace WfServiceHost 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      Console.WriteLine("Creating workflow runtime..."); 
      using (WorkflowRuntime wr = new WorkflowRuntime()) 
      { 
       SqlTrackingService ts = new SqlTrackingService("Initial Catalog=Tracking;Data Source=localhost;Integrated Security=SSPI;"); 
       ts.UseDefaultProfile = true; 

       wr.AddService(ts); 

       wr.StartRuntime(); 

       Console.WriteLine("Creating workflow instance..."); 
       WorkflowInstance wi = wr.CreateWorkflow(typeof(My3Activity)); 

       Console.WriteLine("Starting workflow instance..."); 
       wi.Start(); 
       Console.WriteLine("Workflow instance started"); 
       Console.WriteLine("Press any key to STOP"); 
       Console.ReadKey(); 
      } 
      Console.WriteLine("Workflow runtime stopped."); 
      Console.WriteLine("Press any key to exit..."); 
      Console.ReadKey(); 
     } 
    } 
} 

WF4.0 (이벤트를 발생시키지 않습니다 또는 아마 그들은 추적 서비스에 의해 사로 잡았되지 않음) .NET 3.5 워크 플로 활동 라이브러리로 컴파일,이 시간 MyActivity)는 .NET 4.0 WF 활동 도서관입니다

namespace WfServiceHost 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      Console.WriteLine("Creating workflow runtime..."); 
      using (WorkflowRuntime wr = new WorkflowRuntime()) 
      { 
       SqlTrackingService ts = new SqlTrackingService("Initial Catalog=Tracking;Data Source=localhost;Integrated Security=SSPI;"); 
       ts.UseDefaultProfile = true; 

       wr.AddService(ts); 

       wr.StartRuntime(); 

       Console.WriteLine("Creating workflow instance..."); 
       MyActivity activity = new MyActivity(); 
       WorkflowApplication app = new WorkflowApplication(activity); 

       Console.WriteLine("Starting workflow instance..."); 
       app.Run(); 
       Console.WriteLine("Workflow instance started"); 
       Console.WriteLine("Press any key to STOP"); 
       Console.ReadKey(); 
      } 
      Console.WriteLine("Workflow runtime stopped."); 
      Console.WriteLine("Press any key to exit..."); 
      Console.ReadKey(); 
     } 
    } 
} 

답변

1

WF3과 WF4 간에는 아무런 관련이 없습니다. 후자는 완전한 재 작성이며 이전 WF3과 어떤 유형도 공유하지 않습니다. 따라서 .NET 4의 SqlTrackingService는 WF3에서만 작동합니다.

두 번째 코드 예제는 흥미로운 WF3 및 WF4 형식의 혼합입니다. WorkflowApplication은 WF4이고 WorkflowRuntime은 WF3입니다. 이것들을 대체하는 것은 전혀 이해가되지 않습니다.

namespace WfServiceHost 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      Console.WriteLine("Creating workflow instance..."); 
      MyActivity activity = new MyActivity(); 
      WorkflowApplication app = new WorkflowApplication(activity); 

      Console.WriteLine("Starting workflow instance..."); 
      app.Run(); 
      Console.WriteLine("Workflow instance started"); 
      Console.WriteLine("Press any key to STOP"); 
      Console.ReadKey(); 
     } 
    } 
} 
: 코드의 모양은 의도 된 경우

WF4 할 수

관련 문제