WF4中SendResponse的行为

Mau*_*uro 5 workflow xaml workflow-foundation-4 xamlx

在我的模板工作流程的顶部,我放置了一个ReceiveRequest/SendReply块,我想执行同步操作,然后启用用户客户端及时响应正在启动的工作流程.客户端通过WCF调用WF.

客户端知道当前请求的状态以及我的应用程序数据库上的条目的状态.

例如,我创建一个订单,调用PlaceOrderWF,将DB上的订单状态设置为"Accepted".然后,当WF正在进行检查,控制等时,客户端可以执行他想要的任何操作,......将订单的最终值设置为"已完成"或"错误".

我希望客户端会在SendResponse块之后收到响应.实际上它似乎没有这种方式工作,但它等待某种"事件"来释放客户端.不幸的是,我没有事件触发此行为的证据.

要测试它,只需在SendResponde活动之后放置一个Delay活动,您应该能够重现我正在谈论的行为.

有关如何避免这种不必要的错误的任何提示?

WF模板 - 操作名称故意留空

Mau*_*ice 5

The workflow will continue and execute as much as it can on the current thread and as a result doesn't return to the caller right away.If you add a Delay with a small timeout, say 1 second, to the workflow this will cause the workflow to go idle and the WCF response to be send to the client after which the workflow will continue.