List of objects sent over WCF, but null list received?

Posted by GONeale on Stack Overflow See other posts from Stack Overflow or by GONeale
Published on 2010-04-17T13:04:39Z Indexed on 2010/04/17 13:13 UTC
Read the original article Hit count: 505

Filed under:
|

Hey there,

I have an object containing a list of custom objects which I am returning over a response in WCF, however on the receiving end, the list is null? But it contains 112 objects just prior to stepping out of the service on the server.

This wasn't always the case, I have seen it return a list. I've just recently upgraded it to use NET TCP bindings, but I can't confirm when I started losing the data or if it was since the conversion from wsHttpBinding to netTcpBinding as it moved along with about four other services.

I have looked on the WCF Service messages and trace file and also the WCF client's messages and trace file, no exceptions reported, and both message logs indicate they are sending the List<T> and for client, receiving the list - very frustrating!

It's not a super light array, but not huge either, around 100KB. it has about 12 properties each and as stated 112 items are being sent.

I have tried everything I can think of on client and server, note:

Client:

this.binding = new NetTcpBinding(SecurityMode.None)
                               {
                                   MaxReceivedMessageSize = int.MaxValue,
                                   ReaderQuotas = {
                                       MaxStringContentLength = int.MaxValue,
                                       MaxArrayLength = int.MaxValue 
                                   }
                               };
...

Server app.config (sorry I have no idea if the quota settings have any bearing on net tcp? I only just added it similar to what I use for wsHttpBinding to test, but still list is null):

<netTcpBinding>
            <binding name="SecurityByNetTcpTransportBinding" sendTimeout="00:03:00"
              maxReceivedMessageSize="2147483647">
              <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
              <security mode="None" />
            </binding>
    </netTcpBinding>

and something else I tried in my net tcp binding behavior:

<dataContractSerializer maxItemsInObjectGraph="2147483647" />
          <serviceTimeouts transactionTimeout="05:05:00" />
          <serviceThrottling maxConcurrentSessions="400" maxConcurrentInstances="400" maxConcurrentCalls="400"/>

I hope somebody can help, I hate 5 steps forward 3 steps backward which always seems to be the case with WCF :P

In the interim until I [hopefully] get a response I will now try reducing this array just to see if it's a sizing issue..

Ok, It seems I have bigger problems. Because the list was the only thing I was sending, I thought it was an array issue. I am even setting an int to "25" and it's coming back as 0 - Anybody? I know I must have done something obviously stupid.

© Stack Overflow or respective owner

Related posts about wcf

Related posts about nettcpbinding