Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Return large data on service

I have a method that returns a large list of objects. When I return a few objects (10) everything works great. The problem is when I try to return 100 objects. The reason why the list is so big is because the objects in the list have other objects inside so I am basically returning a tree.

Anyways I am using named pipes and here is the configuration of the enpoint I am using:

<netNamedPipeBinding>
      <binding name="NetNamedPipeBinding_ISymbolFileParser" 
                      closeTimeout="00:10:00"
                      openTimeout="00:10:00" 
                      receiveTimeout="00:10:00" 
                      sendTimeout="00:10:00"
                      transactionFlow="false" 
                      transferMode="Buffered" 
                      transactionProtocol="OleTransactions"
                      hostNameComparisonMode="StrongWildcard"
                      maxBufferPoolSize="2147483647"
                      maxBufferSize="2147483647" 
                      maxConnections="10" 
                      maxReceivedMessageSize="2147483647"
                     >
              <readerQuotas 
                   maxDepth="32" 
                   maxStringContentLength="2147483647" 
                   maxArrayLength="2147483647"
                   maxBytesPerRead="4096" 
                   maxNameTableCharCount="2147483647" />                    
      </binding>
</netNamedPipeBinding>

When I limit the number of objects by doing results.Take(10).ToArray(); everything works great. When I return 100 objects I get the exception:

enter image description here


Things I have done to try to solve the problem:

  1. I increase the numbers in the config file to 2147483647
  2. Instead of returning the list of objects I serialized the list my self on the service and then created a Test method that will return byte[] instead of the list. Then on the client I deserialize the byte[] to a list and that works! So I have a solution so far the worst case scenatio would be that I have to serialize the object my serlf and deserialize it.

I will like to take also an opportunity to ask if I should be using a different binding. I heard that shared memory is the fastes but I don't know how to use that on wcf. Because I am communicating between the same machine I am using named pipes.

like image 521
Tono Nam Avatar asked Dec 16 '25 22:12

Tono Nam


1 Answers

Looks like serialization issue, try increase dataContractSerializer maxItemsInObjectGraph thru behaviors in endpointBehaviors and serviceBehaviors.

The same problem here

like image 112
GSerjo Avatar answered Dec 19 '25 13:12

GSerjo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!