Consuming a WCF service that downloads a large amount of data from a Sharepoint2010 List.

I wrote a test client (using inbuilt automated tests in VS 2010). When I invoke the service method, I get

System.TimeoutException: The request channel timed out while waiting for a reply after 00:00:59.9511700. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.

On my client, the (app.config) configuration is as follows:

 <binding name="BasicHttpBinding_SalesInfoServiceContract"
                closeTimeout="00:12:00" openTimeout="00:12:00" receiveTimeout="00:12:00"
                sendTimeout="00:12:00" allowCookies="false" bypassProxyOnLocal="false"
                hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647"
                maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
            realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />

I've increased the timeout, and increased the max buffer size.

The web.config is as follows:

<service name="XXX.WebServices.SalesInfo.SalesInfo" behaviorConfiguration="SalesInfoServiceBehavior">
    <endpoint address="" binding="basicHttpBinding" contract="XXX.WebServices.SalesInfo.ISalesInfo" />
    <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
  <behavior name="SalesInfoServiceBehavior">
          <add scheme="http" port="9083" />
      <serviceDebug includeExceptionDetailInFaults="false" />
      <serviceMetadata httpGetEnabled="true" />
      <dataContractSerializer maxItemsInObjectGraph="2147483646" /> <== Tried adding this tag

If i directly instantiate the service class, the method works - so i know my logic is right. It takes about 1m:45s.

Any ideas what other timeout i need to increase?

  • Can you show more of your Server and Client configurat? Like which protocol you are using? Ops, did not read propperly see the binding now. :)
    – Robban1980
    Jul 24, 2014 at 23:40

2 Answers 2


Robban1980, good suggestion, went down that path, but realized problem was on my client side.

My client was ignoring my app.config (not sure why)

I eventually worked around the problem by setting the timeouts in code like this:

 SalesInfoServiceServiceContractClient client = new SalesInfoServiceServiceContractClient();
((BasicHttpBinding)client.Endpoint.Binding).MaxReceivedMessageSize = int.MaxValue;
((BasicHttpBinding)client.Endpoint.Binding).MaxBufferSize = int.MaxValue;
foreach (OperationDescription op in client.Endpoint.Contract.Operations)
    var dataContractBehavior = op.Behaviors.Find<DataContractSerializerOperationBehavior>();
    if (dataContractBehavior != null)
        //do this else you get error about limitations on number of objects that can be deserialized
        dataContractBehavior.MaxItemsInObjectGraph = int.MaxValue; 
client.Endpoint.Binding.SendTimeout = new TimeSpan(0, 2, 30);

// rest of the client
SalesInfoDataItems items= client.GetSalesData(XXX);

On your client-side, you have increased the timeout settings but you have not done so on your server-side.

try adding something like this to your server-side basicHttpBinding (and if your operation takes 1 hour and 45 minutes you probably need to increase the send/receive timeouts on the client too)

<endpoint address="" 
    contract="XXX.WebServices.SalesInfo.ISalesInfo" />

    <binding name="myBindingConfiguration" 
          <security mode="None" />


For details refer to this article.

  • Thanks, i'll give this a shot. And i'm a doofus. I meant to say the operation takes 1:45, not 1:45:00. Edited.
    – ndhar
    Jul 29, 2014 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.