我想知道是否可以从文件加载xamlx wcf工作流并使用WorkflowApplication运行它?
期望的结果:
using (Stream xaml = File.OpenRead("Service1.xamlx"))
{
activity = ActivityXamlServices.Load(xaml);
}
var workflowApplication = new WorkflowApplication(activity);
workflowApplication.Run();
答案 0 :(得分:3)
提取WorkflowService Root并在wfApp
上运行它var svc = (WorkflowService)XamlServices.Load("c:\\path\\Service1.xamlx");
WorkflowApplication wfApp = new WorkflowApplication(svc.Body);
wfApp.Run();
仍然没有理解在WorkflowApplication中运行WorkflowService的原因。请记住,反向(带有作为WorkflowService的接收活动的运行活动工作流)是完全有效的。
答案 1 :(得分:0)
未使用WorkflowApplication公开端点。请改用WorkflowServiceHost
WorkflowServiceHost host = new WorkflowServiceHost(activityLoadedFromXaml, baseAddress);
host.Description.Behaviors.Add(new System.ServiceModel.Description.ServiceMetadataBehavior() { HttpGetEnabled = true });
host.AddDefaultEndpoints();
host.Open();