为什么在Workflow Service中将活动放在Receive和SendReply之间而不是它们之后

时间:2012-07-03 14:29:10

标签: wcf workflow-foundation-4 workflowservice

我在Workflow Services上看到的大多数示例都在Receive和SendReply活动之间放置了活动。但是,如果活动需要很长时间才能完成服务超时。我可以增加超时或将活动放在SendReply之后。是否有关于在哪些地方开展这些活动的最佳做法?

1 个答案:

答案 0 :(得分:3)

无需在接收和发送回复之间保留所有活动。您的活动将在完成SendReply活动后执行。对于日志运行进程,发送回复可以发送与客户端消息相关的服务启动或任何异常。 sendreply完成后将执行工作流程。

你可以遵循这种方法..

1. Put receive activity  as first activity on the workflow.
2. Apply validation on Data contract used as argument.
3. Put a code activity that can set WorkflowinstanceID  in out parameter that can return as response from send reply. This is can
be used to control Workflow.
4. Add another send reply by right click on Receive activity, return response if any validation faults occur.
5. Put rest of activity below of send reply configure service behavior for any unhandled exception.