Thursday, August 8, 2013

maxstringcontentlength, maxbuffersize, and maxreceivedmessagesize (and others) in WCF

MaxDepth – A positive integer that specifies the maximum nested node depth per read. The default value is 32. Maximum is 2147483647.
MaxBufferSize – Gets or sets the maximum size of the buffer to use. For buffered messages this value is the same as MaxReceivedMessageSize. For streamed messages, this value is the maximum size of the SOAP headers, which must be read in buffered mode. Default value is 65536. Maximum value is 2147483647.
MaxReceivedMessageSize -  Gets or sets the maximum size for a message that can be processed by the binding. Must match what you put in the MaxBufferSize.  Default value is 65536. Maximum is 2147483647.
MaxStringContentLength – A positive integer that specifies the maximum characters allowed in XML element content. Default value is 8192. Maximum is 2147483647. This property actually belongs to the XMLReader that is called under the covers by WCF.  When deserializing the message this property is used to block messages over a certain size.
MaxArrayLength – A positive integer that specifies the maximum allowed array length of data being received by WCF from a client. The default value is 16384. Maximum is 2147483647.
MaxBytesPerRead – A positive integer that specifies the maximum allowed bytes returned per read. The default value is 4096. Maximum is 2147483647.
MaxNameTableCharCount– A positive integer that specifies the maximum characters allowed in a table name. The default value is 16384. Maximum is 2147483647.
MaxArrayLength – A positive integer that specifies the maximum allowed array length of data being received by WCF from a client. The default value is 16384. Maximum is 2147483647.



bindings>
   <webHttpBinding>
    <binding name="wsHttpBinding" closeTimeout="00:01:00"
       openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
       allowCookies="false" bypassProxyOnLocal="false"
       hostNameComparisonMode="StrongWildcard"
       maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
       maxReceivedMessageSize="2147483647"
       transferMode="Buffered"
       useDefaultWebProxy="true">
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                          maxArrayLength="2147483647"
                          maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
   </webHttpBinding>
  </bindings>


Give same binding on server and on client side 
otherwise you will get error..

No comments:

Post a Comment

Opps Part 1 : Abstraction

  Abstraction in C# is a fundamental concept of object-oriented programming (OOP) that allows developers t...