Bulb Flash: WCF Size and Time restrictions!

While working on a Silverlight client and WCF service i hit a major roadblock when i realized that WCF has a lot of restrictions when it comes to communication. Restrictions in terms for time and  message size

The restriction is not only for size of a message but depth of message which is pretty relevant for Database entities being passed , number of elements in an array and even max length of the string incase you try DataContractSerialization

Use the following settings in your server side to overcome the time and message size restrictions to the max limit possible..

Use the following settings on your BasicHttpBinding


‘For timing
<binding name=”BasicHttpBinding_XBOX” closeTimeout=”05:20:00″ openTimeout=”05:20:00″ receiveTimeout=”05:20:00″ sendTimeout=”05:20:00″

for message size

maxBufferSize=”2147483647″ maxBufferPoolSize=”2147483647″ maxReceivedMessageSize=”2147483647″ messageEncoding=”Text” textEncoding=”utf-8″ transferMode=”Buffered” useDefaultWebProxy=”true”>

maxDepth=”2147483647″ maxStringContentLength=”2147483647″ maxArrayLength=”2147483647″
maxBytesPerRead=”2147483647″ maxNameTableCharCount=”2147483647″>

         <security mode=”None”>
           <transport clientCredentialType=”None” proxyCredentialType=”None”
               realm=”” />
           <message clientCredentialType=”UserName” algorithmSuite=”Default” />

Add the following behaviour in the service behaviour

<behavior name=”SampleServiceBehavior”>
<dataContractSerializer maxItemsInObjectGraph=”2147483646″/>

Similar settings are needed at the client app.config also.

Following snapshot shows the settings


If you are using Silverlight as your client then reader quotas etc are not available, but it the good news is that it reads the values from the server so it still works..

So all you need to do for Silverlight is(apart from the server side changes) make the following settings in the ServiceReferences.ClientConfig


Hope this marks the end of your messaging blues..Hope this bulb flash saved you some hours a grey cells!!


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>