Home  /  Questions  /  Question



68   95.9
Feb 09, 2011


WCF - Large Data send to client

I added 1,3000 records in customer table in Patterns in Action 4.0 sample.  When I run the sample, WCF timeout error occurred.
I modified the maxReceivedMessageSize="2147483647", maxStringContentLength="81920" and sentTimeOut="00:10:00", but did not work.

So, I would like to know how to handle the large data return from WCF to client?
WCF



50   50
Feb 18, 2011
Maybe you can try to set max value for maxItemsInObjectGraph behavior both server and client side. 
   <
behaviors>       
<
endpointBehaviors>         
<
behavior>         
  <
dataContractSerializer maxItemsInObjectGraph="2147483646" />    
     </
behavior>   
    </
endpointBehaviors>
    </
behaviors>

296   99.8
Mar 01, 2011
Well, one could ideally use the MTOM encoding with the WCF to transfer large objects. The below link would be able to help you out on this.

http://msdn.microsoft.com/en-us/library/aa395209.aspx

1,364   100.0
Mar 01, 2011
I have faced similar things and the following things work for me.

// Change the values  in no. as required.

maxBufferPoolSize=”100000”

maxBufferSize = “100000”
maxReceivedMessageSize=”100000”

<behaviors>
   <behavior name="YourServiceBehavior">
       <dataContractSerializer maxItemsInObjectGraph="200000" />

   </behavior>
</behaviors>


On more thing...

Set the OperationTimeout on the IChannel proxy interface as follows... I am unable to find a config setting for the same.


//  This can be done while creating the proxy
((IContextChannel)base.Channel).OperationTimeout = timeout;

For e.g.

  public partial class ServiceFooClient :   ClientBase<IServiceFoo>,IServiceFoo
  {
    
public IServiceFoo SetOpTimeout(TimeSpan timeout) {

            ((
IContextChannel)base.Channel).OperationTimeout = timeout;
     }
  }

  Hope this helps....  
 

  





50   50
May 31, 2011
Consider reading the official MS documentation about large data and streaming in WCF.
It  highlights some general concerns and considerations for encodings, binary data, and streaming that generally apply to connected systems infrastructures.


70   96.1
Feb 10, 2011

There are a several timeout setting not only the sentTimeOut, always remember that just because you don't see a setting doesn't mean it doesn't exist.
There are several settings and if you don't see it, it will use its default value.

Note the various Timeout settings here:

<binding name="WSHttpBinding_ITimeOutDemoService" closeTimeout="00:10:00"
                    openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" ........
 <reliableSession ordered="true" inactivityTimeout="00:10:00"

There is also the executionTimeout in the web.config which is set under configuration - system.web - httpRuntime executionTimeout as shown below.
The default for this is 110 seconds. When you have slow service operations which could causes timeouts to occur the request will be aborted and you will find an entry in the ASP.NET EventLog that informs you that the request has timed out.

<configuration>
  <system.web>
  <httpRuntime executionTimeout="600"/>
  </system.web>
</configuration>

Note that 600 is 10 minutes.

Then remember that if IIS is hosting the WCF Service there are timeout settings which need to be managed there as well.

This is certainly not all there is to know about TimeOut settings but I hope this points you in the right direction.

Good luck Emily


Ricky

 1 comment
 
Thanks! Other than changing the TimeOut setting, I also change the maxItemsInObjectGraph=&quot;2147483647&quot; and it works now. --- Emily Fong  Feb 17, 2011