Programming

WWF - Windows workflow foundation

콜러스 XXII 2006. 12. 28. 16:42

 

WWF를 잠시 시간을 내어서 공부할 일이 있었는데 우선 .NET framework 3.0을 깔기위한 장대한 작업이

 

어제 있었다. 내 PC는 XP라 깔게 많아 보였는데 결국 다음과 같은 것만 깔았다.

 

1. Update to VS2005 SP1 (까는데 무쟈게 오래걸린다.)

   [주의점]

   To work around this problem, follow these steps:
        1. Click Start, click Run, type control admintools, and then click OK.
        2. Double-click Local Security Policy.
        3. Click Software Restriction Policies.

        Note If no software restrictions are listed, right-click Software Restriction Policies,

        and then click Create New Policy.
        4. Under Object Type, double-click Enforcement.
        5. Click All users except local administrators, and then click OK.
        6. Restart the computer.

 

  [발생될수 있는 문제]

       http://support.microsoft.com/?kbid=928957

 

2. Install .NET Framework 3.0 redistributable
3. Windows SDK for Vista

4. VS2005 extensions for WCF and WP (CTP)
5. VS2005 extensions for WWF

 

이렇게 요약 되겠다. 4번은 CTP라 좀 불안해 보이긴했다.

 

전부 설치한뒤에 WWF의 예제 프로젝트를 만들어서 바로 돌려보니 다음과 같은 에러가 났다.

 

The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.

 

컼... 아무리 Security가 강화 되었다지만 자기회사에서 생성된 코드가 에러가 나다니...

 

워닝이라도 주던가. --.--a

 

이리저리 찾아본 결과 WorkflowRuntimeSection.EnablePerformanceCounters 를 죽이기로 했다.

 

보통 WWF Project를 Console 버젼으로 하나 만들면 Main()이 다음과 같이 나오게 되는데

 

(당근 에러나는 코드이다.)

 

static void Main(string[] args)
{
     using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())            
     {
          AutoResetEvent waitHandle = new AutoResetEvent(false);
          workflowRuntime.WorkflowCompleted += delegate(object sender,

                WorkflowCompletedEventArgs e)

          {

               waitHandle.Set();

          };
          workflowRuntime.WorkflowTerminated += delegate(object sender,

               WorkflowTerminatedEventArgs e)
          {
               Console.WriteLine(e.Exception.Message);
               waitHandle.Set();
          };
                
          WorkflowInstance instance = workflowRuntime.CreateWorkflow(

               typeof(WWFTest2.Workflow1));                                
          instance.Start();

          waitHandle.WaitOne();
     }
}

 

 

static void Main(string[] args)
{
     WorkflowRuntimeSection rs = new WorkflowRuntimeSection();     // 추가
     rs.EnablePerformanceCounters = false;

     

     using (WorkflowRuntime workflowRuntime = new WorkflowRuntime(rs))      

     {
          AutoResetEvent waitHandle = new AutoResetEvent(false);
          workflowRuntime.WorkflowCompleted += delegate(object sender,

                WorkflowCompletedEventArgs e)

          {

               waitHandle.Set();

          };
          workflowRuntime.WorkflowTerminated += delegate(object sender,

               WorkflowTerminatedEventArgs e)
          {
               Console.WriteLine(e.Exception.Message);
               waitHandle.Set();
          };
                
          WorkflowInstance instance = workflowRuntime.CreateWorkflow(

               typeof(WWFTest2.Workflow1));                                
          instance.Start();

          waitHandle.WaitOne();
     }
}

 

이렇게 펄프카운터를 죽였다. 나중에 필요할수도 있으나 일단 Tutorial을 위해서 막아 주기로 했다.

 

  

State Machine을 이걸로 함 구현해봐야 겠다. 예전엔 DP를 이용해서 순수 손으로 꽤 쓸만한

 

State mahine을 만들었었는데... 세월 좋아 졌다. 근데 동작이 좀 굼뜨는 느낌이다.

 

오늘 WPF도 Test해보았으나 Tutorial 문서와 실제 Compile된것 사이에서 문제가 좀 발생했다.

 

다음으로 미뤄야 겠다.