简体   繁体   中英

WCF service optimal configuration

I am using basicHttpBinding for my wcf service

<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>

Please let know what values I should put for maxArrayLength , maxItemsInObjectGraph , open/close and receive timeouts. If I set this to max allowed values, is there any harm in doing that?

How size and timeout values should be defined optimally?

Optimally always heavily depends on what exactly it is you're doing and what your requirements are.

There's not ONE optimal setting -- don't you think the WCF team would have made that the default setting, if it existed?

Also:

YES setting everything max allowable size opens the door for potential denial-of-service attacks - that's the reason it's NOT set to 2 GB for each of those size values in the first place!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM