Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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"
                useDefaultWebProxy="true">
      <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" />
      </security>

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" />
  </service>
  <behavior name="SalesInfoServiceBehavior">
      <useRequestHeadersForMetadataAddress>
        <defaultPorts>
          <add scheme="http" port="9083" />
        </defaultPorts>
      </useRequestHeadersForMetadataAddress>
      <serviceDebug includeExceptionDetailInFaults="false" />
      <serviceMetadata httpGetEnabled="true" />
      <dataContractSerializer maxItemsInObjectGraph="2147483646" /> <== Tried adding this tag
    </behavior>

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?

share|improve this question
    
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 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);
client.Close();
share|improve this answer

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="" binding="basicHttpBinding" bindingConfiguration="myBindingConfiguration"

contract="XXX.WebServices.SalesInfo.ISalesInfo" />

<bindings>
 <basicHttpBinding>
    <binding name="myBindingConfiguration" 
           receiveTimeout="02:00:00"
           sendTimeout="02:00:00"
           openTimeout="00:12:00"
           closeTimeout="00:12:00">
          <security mode="None" />
     </binding>
 </basicHttpBinding>

Reference: http://msdn.microsoft.com/en-us/library/ms731361(v=vs.110).aspx

share|improve this answer
    
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 at 19:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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