WCF - 我是否需要在客户端和服务器上配置绑定(可能是基础)但是感到困惑。你能澄清一下吗?)

时间:2011-10-23 15:33:15

标签: wcf wcf-binding

我正在使用NetNamedPipeBding与本地计算机中的服务进行通信。我理解我需要为客户端定义配置设置,如maxstringcontentlength,sendtimeout,maxbyteperread等......我是否还需要在服务器端定义相同的设置?这两者之间有什么关系?如果客户端在连接时没有配置设置,它是否会使用其默认绑定设置?他们完全独立吗?

如果您有任何疑问,请与我联系。如果我的问题本身令人困惑。

-------------------------------------------------

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>

1 个答案:

答案 0 :(得分:1)

某些设置在两端都是相关的,有些设置仅在服务器上有关,而有些设置在客户端上。通常,大多数设置应该具有相同的值,是的,您需要在两端配置绑定。建立连接后,将不会使用其他设置。