我需要在客户端和服务器端配置绑定吗?

发布于 2024-12-11 05:36:28 字数 2271 浏览 2 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倥絔 2024-12-18 05:36:28

有些设置在两端都相关,有些仅在服务器上相关,而有些则在客户端上相关。一般来说,大多数设置应该具有相同的值,是的,您需要在两端配置绑定。连接建立后,一方将不会使用另一方的设置。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文