2011-10-23 40 views
4

我正在使用NetNamedPipeBding與本地計算機中的服務進行通信。我知道我需要爲客戶端定義配置設置,如maxstringcontentlength,sendtimeout,maxbyteperread等......我是否需要在服務器端定義同樣的東西?這兩者之間有什麼關係?如果客戶端在連接時沒有配置設置,它是否會使用其默認綁定設置?他們完全獨立嗎?WCF - 我是否需要在客戶端和服務器上配置綁定(可能基本)但是會感到困惑。你能否澄清)?

請讓我知道如果您有任何問題,以防我的問題本身令人困惑。

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

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

謝謝哈桑。我想深入瞭解這些選擇,尤其是那些與兩端相關的選項。例如:maxstringcontentlength,maxarraylenghth將應用於兩端。如果是,哪一個會得到偏好等等... – Dreamer

相關問題