开发者

WCF WF service correlation exception

Handling multiple push notifications from Exchange Server in WCF WF service, I am getting the following exception and the WF aborts:

"Some context on the correlation handler was not consumed properly". No documentation on this error anywhere afai can see.

Full message: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Some context on the correlation handler was not consumed properly. Make sure that the handler was initialized properly by the runtime and the workflow has a Send followed by Receive or ReceiveReply activity. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.InvalidOperationException: Some context on the correlation handler was not consumed properly. Make sure that the handler was initialized properly by the runtime and the workflow has a Send followed by Receive or ReceiveReply activity. at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Activities.Dispatcher.ControlOperationInvoker.ControlOperationAsyncResult.End(Object[]& outputs, IAsyncResult result) at System.ServiceModel.Dispatcher.Disp开发者_运维问答atchOperationRuntime.InvokeEnd(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage7(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)).


OK I figured this out. What was happening, to cut a long story short, was a race condition where a Receive with both query correlation and Request-Reply correlation was handling multiple messages with the same correlation ID by sitting in a do-while loop. The aim was to process the first one of many messages with the same id, discarding the rest. The first message caused a parallel process to start by raising a flag for a waiting Sequence (with the Send Reply a second later), while subsequent messages were discarded (with the Send Reply occuring immediately).

The problem was that the second message was coming in before the first SendReply had passed. This caused the correlation initialiser to overwrite the Request Reply correlation handler that the first one needed to use. It seems that this is what causes the above exception. I fixed this temporarily by making the SendReply happen immediately, though when I have time I will look at using multiple Correlation Handlers for the Receive Reply. (A dictionary of handlers based on some message id??)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜