重试WCF服务的逻辑 [英] Retry logic for WCF service

查看:93
本文介绍了重试WCF服务的逻辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个WCF服务和一个操作合同,它将返回一个Object.

I have a WCF service and an operation contract which will return an Object.

此WCF服务将由外部系统使用,

This WCF service will be utilised by an external system,

从WCF服务返回对象时,如果发生任何通信故障,WCF服务必须尝试10次.

While returning the object from WCF service, the WCF service has to try 10 times if any communication failure happens.

能否请您提出一种更好的方法来解决这种情况.

Could you please suggest a better way handle this scenario.

预先感谢

推荐答案

您好,Divya,

您是否要重试从WCF到客户端的响应?如果是这样,我认为您可以尝试在服务器上缓存结果一段时间(有限的时间).您可以为每个请求提供唯一的ID,然后在服务器上检查具有该ID的请求是否已完成 已经(如果是的话)-立即交付结果.否则,处理响应并将其缓存有限的时间,以防客户端稍后重试.在客户端上-只需重试失败即可.

Do you mean you want to retry the response from WCF to client? If so, I think you could try cache results on server for some (limited) time. You can provide unique id for each request, then on server check if request with such id was completed already and if yes - deliver the results immediatly. Otherwise, process response and cache it for limited time, in case client will retry a bit later. On client - just retry on failure.

我建议您参考下面的链接以获取更多信息.

#如何在连接断开后在WCF可靠消息传递中从服务器接收响应

最好的问候

爱德华


这篇关于重试WCF服务的逻辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆