我已经使用WorkflowServiceHost中,WorkflowServiceHostFactory和WorkflowHostingEndpoint的应用程序,主机WF4.5工作流程IIS。WF 4.5书签自定义活动不火持续/卸载
工作流由VS 2013在.xaml文件中定义。在工作流程中,具有用于接收来自用户的输入数据的自定义活动。获取使用CreateBookmark和Resume的回调。
我的问题是:第一个活动执行,工作流实例进入空闲,持久和卸载。在恢复第一个书签之后,第二个活动执行一个工作流实例只进入空闲状态。因此只有第一个活动才能使工作流实例保持并卸载。
要验证我的主机实现是否正常工作,我使用了延迟活动并且一切正常。
我的自定义活动:
public sealed class WaitForResponse<TResult> : NativeActivity<TResult>
{
public string ResponseName { get; set; }
protected override bool CanInduceIdle
{
get
{
return true;
}
}
protected override void Execute(NativeActivityContext context)
{
context.CreateBookmark(this.ResponseName, new BookmarkCallback(this.ReceivedResponse));
}
protected void ReceivedResponse(NativeActivityContext context, Bookmark bookmark, object obj)
{
this.Result.Set(context, (TResult)obj);
}
}
IWorkflowCreation client = new ChannelFactory<IWorkflowCreation>(new NetNamedPipeBinding(NetNamedPipeSecurityMode.None), new EndpointAddress("net.pipe://localhost/workflowCreationEndpoint")).CreateChannel();
//create an instance
Guid id = client.Create(null);
// Resume
client.ResumeBookmark(id, "1", "Message 1");
一个书签的活动进行了总结(createbookmark /简历)的情况下没有更多的坚持/卸载后。
换句话说,只有第一个书签活动集实例才会卸载。是的,我设置了TimeToPersist/TimeToUnload。
这里是实例的跟踪状态: 开始,空闲,坚持,卸载,已恢复,空闲,空闲,空闲,空闲,空闲,已完成,已删除。
我创建了一个演示问题的示例解决方案。
我真的很感激,如果有人能帮助我。感谢您的任何帮助!
谢谢你的帮助!
在我的WorkflowServiceHostFactory类中,我通过WorkflowIdleBehavior配置了workflowIdle。这对于第一个活动来说工作得很好,但是第二个活动只保持空闲。 – 2014-10-02 16:44:28
请看看我发布的示例。 – 2014-10-03 17:53:57
检查我编辑的答案。希望能帮助到你。 – Joao 2014-10-05 17:33:12