It’s been a while since I last posted but I’m here again to show you something that may be useful to some of you out there.

Probably you struggled with WCF and may have seen a lot of errors which you don’t know where they come from. Here I have some hints that maybe can solve one of these problems you are finding.

If you get this error message: “The server did not provide a meaningful reply; this migth be caused by a contract mismatch, a premature session shutdown or an internal server error”

Then try to rise the maxItemsInObjectGraph attribute of the dataContractSerializer property in the behaviour configuration section of your web.config:

 <behavior name="myBehaviour">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceAuthorization impersonateCallerForAllOperations="false" />
         <dataContractSerializer maxItemsInObjectGraph="999999"/>

If you are experiencing timeouts then you just have to set the sendTimeout property of your binding to a higher value: sendTimeout=”00:10:00″ should be fine.

And finally, you may not be able to receive all the data information that the service is giving to you, so you may increase this attributes of your binding. This is the maximum amout you will ever get:

maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647" />

I hope this may have help some of you!