是否WCF NetTcpBinding的提供持久的连接? [英] Does WCF NetTcpBinding provide a persistent connection?

查看:512
本文介绍了是否WCF NetTcpBinding的提供持久的连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

制作使用WCF客户端/服务器风格的应用程序,但我找不到解释,如果NetTcpBinding的提供了一个永久连接的任何文档?

Making a client/server style app using WCF, but I can't find any documentation that explains if the NetTcpBinding provides a persistent connection?

我想我的客户端连接,并同时保持连接到服务器上几个星期。 (是的,我知道我需要处理断开等。)

I would like my client to connect and remain connected to the server for weeks at a time. (Yes I know I need to handle disconnects etc..)

是否NetTcpBinding的允许,因为这很长的连接,例如?如果是的话有什么我需要指定或者这是默认的行为?

Does the NetTcpBinding allow for a long connection such as this? If so is there anything I need to specify or is this default behaviour?

推荐答案

只要你保持服务主机和客户端代理活着开业,WCF底层的连接应保持以及开放。甚至低于,似乎从TCP连接池结合使用的连接,如在 NetTcpBinding的MSDN页面

As long as you keep the service host and client proxy alive and opened, the underlying connection in WCF should remain opened as well. Even below that, it appears that the binding uses connections from the TCP connection pool, as found on the NetTcpBinding MSDN page:

NetTcpBinding的使用TCP连接池基础在服务的主机DNS名称和服务正在侦听的端口号。

The NetTcpBinding uses TCP connection pooling based on the service’s host DNS name and the port number the service is listening on.

我不是如何TCP连接池的专家作品中,你可能会想尝试一个姊妹网站,如 ServerFault 了解更多这方面的细节。

I'm not an expert on how TCP connection pooling works, you may want to try a sister site such as ServerFault for more details on this.

如果你想在这一切的控制,那么唯一的财产,我可以看到,可以调整为超出现成的NetTcpBinding的是的 MaxConnections最大 。但是,如果你的真正的愿意潜入深海,你也可以建立自己的自定义一个的 TcpTransportBindingElement ,这让你即使在的 TcpConnectionPoolSettings

If you want control over all this, then the only property I can see that can be tweaked for the out-of-the-box NetTcpBinding is MaxConnections. However, if you're really willing to dive deep you can also build your own Custom Binding with a TcpTransportBindingElement, that gives you even more fine-grained control on the TcpConnectionPoolSettings.

在任何情况下,如果我是冒险一想我会想建立服务主机和客户端代理将需要更多的时间(相对)比以往任何时候花正从池中的连接,因此保持这两个打开可够你的要求。

In any case, if I were to venture a guess I'd think building the service host and client proxy will take far more time (relatively) than any time spent getting a connection from the pool, so keeping those two opened may be enough for your requirements.

我问评论的为什么的所需的连接保持打开状态的原因是因为很难在本身的要求。速度和响应时间的的真正需求的,所以最好的建议是可能使这些需求明确的(量化/符合您对速度的需要),并运行一些测试,以确定什么是最好/需要您的具体情况

The reason I asked in a comment why you want the connection to remain open is because that can hardly be a requirement in itself. Speed and response times are a real requirement though, so the best advice is probably to make those requirements explicit (quantify / qualify your need for speed) and run some tests to determine what's best/needed for your situation.

这篇关于是否WCF NetTcpBinding的提供持久的连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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