我需要在客户端和服务器端配置绑定吗?
我正在使用 NetNamedPipeBding 与本地计算机中的服务进行通信。我知道我需要为客户端定义配置设置,例如 maxstringcontentlength、sendtimeout、maxbyteperread 等。
我是否也需要在服务器端定义相同的内容?这两者之间是什么关系呢?如果客户端在连接时没有配置设置,它会使用其默认绑定设置吗?他们完全独立吗?
例如:我为客户端定义了以下设置
<netNamedPipeBinding>
<binding name="NetNamedPipeBinding_IService" closeTimeout="00:01:00"
openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<!--<transport protectionLevel="EncryptAndSign" />-->
</security>
</binding>
</netNamedPipeBinding>
,并且我还在服务器端定义了类似的设置:
<services>
<service behaviorConfiguration="ServiceBehavior" name="Namespace.Service" />
</services>
<bindings>
<netNamedPipeBinding>
<binding name="NetNamedPipeBinding_Service" closeTimeout="00:01:00"
openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<!--<transport protectionLevel="EncryptAndSign" />-->
</security>
</binding>
</netNamedPipeBinding>
</bindings>
I am using NetNamedPipeBding to communicate with a service in local machine. I understand I need to define the configuration settings for client like maxstringcontentlength, sendtimeout, maxbyteperread etc.
Do I need to define the same things at server side as well? What is the relationship between these two? If the client doesn't have configuration settings while connecting to it, will it use its default binding settings? Are they totally independent?
For ex: I defined the below settings for client
<netNamedPipeBinding>
<binding name="NetNamedPipeBinding_IService" closeTimeout="00:01:00"
openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<!--<transport protectionLevel="EncryptAndSign" />-->
</security>
</binding>
</netNamedPipeBinding>
And I also defined at server side similar settings:
<services>
<service behaviorConfiguration="ServiceBehavior" name="Namespace.Service" />
</services>
<bindings>
<netNamedPipeBinding>
<binding name="NetNamedPipeBinding_Service" closeTimeout="00:01:00"
openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<!--<transport protectionLevel="EncryptAndSign" />-->
</security>
</binding>
</netNamedPipeBinding>
</bindings>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有些设置在两端都相关,有些仅在服务器上相关,而有些则在客户端上相关。一般来说,大多数设置应该具有相同的值,是的,您需要在两端配置绑定。连接建立后,一方将不会使用另一方的设置。
Some settings are relevant on both ends and some are relevant only on the server while some on client. Generally most settings should have same value and yes you need to configure the binding at both ends. One will not use the settings of other after connection is established.