Dofactory.com
Dofactory.com
 Back to list
Views:   33K
Replies:  5
Archived

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?
Emily Fong, Feb 09, 2011
Reply 1
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.

Alexander Molinari, May 31, 2011
Reply 2
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....  
 

  




Rajesh Pillai, Mar 01, 2011
Reply 3
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
Abishek Srikaanth, Mar 01, 2011
Reply 4
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>
Melih Yurtsever, Feb 18, 2011
Reply 5

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

Ricky Owen, Feb 10, 2011
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.