Skip to content

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

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







Add the following behaviour in the service behaviour


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

Following snapshot shows the settings

image

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

image

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

Cennest!!

Leave a Reply

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