WF3.5 的SendActivity、ReceiveActivity与WorkflowServiceHost (2)

WorkflowServiceHost

System.ServiceModel.WorkflowServiceHost

为基于工作流的服务提供宿主

使用 WorkflowServiceHost 对象可加载工作流服务、配置终结点、应用安全设置并启动侦听器来处理传入的请求。

 

WorkflowServiceHost(Stream, Uri)

xoml字节流,服务地址

WorkflowServiceHost(String, Uri)

工作流定义的路径,服务地址

WorkflowServiceHost(Type, Uri)

工作流类型,服务地址

WorkflowServiceHost(Stream, Stream, Uri)

xoml字节流,规则字节流,服务地址

WorkflowServiceHost(String, String, Uri)

工作流定义的路径,工作流规则定义的路径,服务地址

WorkflowServiceHost(Stream, Stream, ITypeProvider, Uri)

xoml字节流,规则字节流,自定义活动类型的类型提供程序,服务地址

WorkflowServiceHost(String, String, ITypeProvider, Uri)

工作流定义的路径,工作流规则定义的路径,自定义活动类型的类型提供程序,服务地址

 

从WorkflowServiceHost中得到引擎

System.ServiceModel.Description.WorkflowRuntimeBehavior

class Program

{

static void Main(string[] args)

{

WorkflowServiceHost host = new WorkflowServiceHost(typeof(WorkflowConsoleApplication2.Workflow1));

 

System.Workflow.Runtime.WorkflowRuntime runtime;

runtime = host.Description.Behaviors.Find<WorkflowRuntimeBehavior>().WorkflowRuntime;

runtime.WorkflowCreated += new EventHandler<WorkflowEventArgs>(runtime_WorkflowCreated);

host.Open();

Console.WriteLine(host.BaseAddresses[0].ToString());

Console.Read();

host.Close();

}

 

static void runtime_WorkflowCreated(object sender, WorkflowEventArgs e)

{

System.Console.WriteLine("WorkflowCreated:" + e.WorkflowInstance.InstanceId.ToString());

}

 

}

 

posted @ 2008-05-23 09:12  WXWinter(冬)  阅读(1638)  评论(1编辑  收藏  举报