开发者

WCF - retry doesn't work?

I have the following config for my binding:

<binding name="wshttp" openTimeout="00:01:00" sendTimeout="00:02:00" receiveTimeout="00:03:00" closeTimeout="00:04:00">
     ..snap
     <reliableSession inactivityTimeout="00:05:00" maxRetryCount="8" ordered="true"/>
     ..snap
</binding>

My expectation here is, that when the client proxy fails to send within 2 minutes, the request should be retried. However:

16:37:49,242 INFO Start process

16:39:49开发者_JS百科,588 FATAL The request operation did not complete within the allotted timeout of 00:02:00

So the application throws an error within 2 minutes, and doesn't retry the request. What should I do to get it to start retrying?


The WCF implementation of WS-ReliableMessaging does not work that way. If a proxy operation times out, no (further) retries will be performed. The retry logic of the protocol applies to messages that have been passed through to the underlying transport but have not been acknowledged at the RM layer, bounded ultimately by the MaxRetryCount and the InactivityTimeout.

Once you receive a CommunicationException or TimeoutException from your proxy channel, you can consider the session to be terminated. At this point, you'll need to reconnect and start over (or if you know where you "left off" and save some state you might be able to recover -- but this logic would be your responsibility to implement).

Basically, you should pass a timeout value which represents the longest duration you're willing to wait for the communication operation to complete. If that fails, then you must Abort() and start over.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜