如何启用单向方法的可靠性? [英] How to enable reliability for one-way methods?

查看:117
本文介绍了如何启用单向方法的可靠性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于单向呼叫,回调和事件的了解文章告诉您:

客户端不关心调用结果的事实并不意味着客户端根本不关心调用是否发生.通常,即使是单向通话,您也应该打开服务的可靠性

我试图找到如何启用可靠性的方法,但没有发现任何有意义的方法.

能帮我吗?

  1. 如何启用可靠性?
  2. 如何检查单向方法是否到达服务器?

非常感谢!

解决方案

我将假设您的意思是"对WCF服务进行编程"(链接的文章的作者)(因此,引号在书中也逐字出现).

可靠性仅在某些绑定上有效.以这个TCP绑定示例为例.在您的配置文件中:

<binding>
    <netTcpBinding>
        <binding name="MyTcpBinding">
            <reliableSession enabled="true" />
        </binding>
    </netTcpBinding>
</binding>

要检查可靠性,我将引用这本书(第66页):

消息的可靠性不能保证 消息传递.它所提供的是 保证如果消息确实 无法到达目的地,发件人 会知道的.

我不知道发件人如何知道,但我从未见过,但希望它能为您提供更多的见解,以便更深入地研究该主题.

进一步阅读:

http://msdn.microsoft.com/en-us/library/ms733136.aspx

The What You Need To Know About One-Way Calls, Callbacks, And Events article tells:

The fact that the client doesn't care about the result of the invocation does not mean the client doesn't care if the invocation took place at all. In general, you should turn on reliability for your services, even for one-way calls

I've tried to find how can I enable reliability, but didn't find anything meaningful.

Could you please help me:

  1. How to enable reliability?
  2. How to check if one-way method reached server?

Thanks a lot!

解决方案

I'm going to assume you mean Message Reliability as described in "Programming WCF Services" by Juval Lowy - the author of your linked article (and consequently that quote appears, word for word, in the book too).

Reliability is only valid on certain bindings. Take this TCP binding example. In your configuration file:

<binding>
    <netTcpBinding>
        <binding name="MyTcpBinding">
            <reliableSession enabled="true" />
        </binding>
    </netTcpBinding>
</binding>

To check reliability I will quote the book (p. 66):

Message reliability does not guarantee message delivery. All it provides is a guarantee that if the message does not reach its destination, the sender will know about it.

I've no idea how the sender will know, I've never encountered it, but hopefully it will give you some more insight to research the topic in more depth.

Further reading:

http://msdn.microsoft.com/en-us/library/ms733136.aspx

这篇关于如何启用单向方法的可靠性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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