2014-02-26 98 views
0

我使用basicHttpBinding的我的WCF服務WCF服務的最佳配置

<basicHttpBinding> 
    <binding name="BasicHttpBinding_UtilityService" 
      closeTimeout="01:00:00" openTimeout="01:00:00" 
      receiveTimeout="01:00:00" sendTimeout="01:00:00" 
      allowCookies="false" bypassProxyOnLocal="false" 
      hostNameComparisonMode="StrongWildcard" 
      maxBufferSize="52428800" maxBufferPoolSize="52428800" 
      maxReceivedMessageSize="52428800" 
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
      useDefaultWebProxy="true"> 
     <readerQuotas 
      maxDepth="52428800" maxStringContentLength="52428800" 
      maxArrayLength="52428800" maxBytesPerRead="52428800" 
      maxNameTableCharCount="52428800"/> 
     <security mode="None"> 
     <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
     <message clientCredentialType="UserName" algorithmSuite="Default"/> 
     </security> 
    </binding> 
</basicHttpBinding> 

<behavior name="httpMetadataBehavior"> 
     <serviceMetadata httpGetEnabled="true"/> 
     <serviceDebug includeExceptionDetailInFaults="true"/> 
     <dataContractSerializer maxItemsInObjectGraph="52428800" /> 
     <serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="200" maxConcurrentInstances="200" /> 
</behavior> 

請讓知道什麼值,我應該把爲maxArrayLengthmaxItemsInObjectGraph,開/關和接收超時。如果我將它設置爲允許的最大值,那麼這樣做會有什麼傷害嗎?

應該如何最優地定義大小和超時值?

回答

0

最適合總是很大程度上取決於您究竟在做什麼以及您的要求是什麼。

有沒有ONE最佳設置 - 你不覺得WCF團隊會默認設置,如果它存在?

另外:

設置一切最大允許大小打開門用於拒絕服務的潛在攻擊 - 這就是它的設置爲2 GB爲每個大小值的原因第一名!