c# - Passing large amounts of data in an WCF service -


i've seen question pop few times no real definitive answer (as there none)... have wcf service needs return approximately 14,000 rows of data sql sorted in list<> based array.

my service config looks like:

<system.servicemodel> <bindings>   <basichttpbinding>     <binding name="basichttpbinding_iparts" closetimeout="00:01:00"         opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00"         allowcookies="false" bypassproxyonlocal="false" hostnamecomparisonmode="strongwildcard"         maxbuffersize="2147483647" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647"         messageencoding="text" textencoding="utf-8" transfermode="buffered"         usedefaultwebproxy="true">       <readerquotas maxdepth="32" maxstringcontentlength="2147483647" maxarraylength="2147483647"           maxbytesperread="2147483647" maxnametablecharcount="2147483647" />       <security mode="none">         <transport clientcredentialtype="none" proxycredentialtype="none"             realm="" />         <message clientcredentialtype="username" algorithmsuite="default" />       </security>     </binding>   </basichttpbinding> </bindings> <servicehostingenvironment multiplesitebindingsenabled="true" /> <behaviors>   <servicebehaviors>     <behavior>       <servicemetadata httpgetenabled="true"/>       <servicedebug includeexceptiondetailinfaults="true"/>       <datacontractserializer maxitemsinobjectgraph="2147483647" />     </behavior>   </servicebehaviors> </behaviors> 

my client config looks like:

<system.servicemodel>     <bindings>         <basichttpbinding>             <binding name="basichttpbinding_iparts" closetimeout="00:01:00"                 opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00"                 allowcookies="false" bypassproxyonlocal="false" hostnamecomparisonmode="strongwildcard"                 maxbuffersize="2147483647" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647"                 messageencoding="text" textencoding="utf-8" transfermode="buffered"                 usedefaultwebproxy="true">                 <readerquotas maxdepth="32" maxstringcontentlength="2147483647" maxarraylength="2147483647"                     maxbytesperread="2147483647" maxnametablecharcount="2147483647" />                 <security mode="none">                     <transport clientcredentialtype="none" proxycredentialtype="none"                         realm="" />                     <message clientcredentialtype="username" algorithmsuite="default" />                 </security>             </binding>         </basichttpbinding>     </bindings>     <client>         <endpoint address="http://localhost/rasfuseservice/parts.svc"             binding="basichttpbinding" bindingconfiguration="basichttpbinding_iparts"             contract="myparts.iparts" name="basichttpbinding_iparts" />     </client>     <behaviors>       <servicebehaviors>         <behavior name="myservicebehavior">           <datacontractserializer maxitemsinobjectgraph="2147483647"/>         </behavior>       </servicebehaviors>     </behaviors> </system.servicemodel> 

something isn't right because i'm getting error:

the formatter threw exception while trying deserialize message: there error while trying deserialize parameter http://tempuri.org/:getsurplusecmresult. innerexception message 'maximum number of items can serialized or deserialized in object graph '65536'. change object graph or increase maxitemsinobjectgraph quota. '. please see innerexception more details.

even though i'm explicitly assigning maxitemsinobjectgraph max int...

i've read streaming , paging, data return in single pass?

figured out (slapped forehead) ended writing incorrect entry on client side. correct syntax client side should have been:

  <behaviors>     <endpointbehaviors>       <behavior >         <datacontractserializer maxitemsinobjectgraph="2147483647"/>       </behavior>     </endpointbehaviors>   </behaviors> 

not

  <behaviors>     <servicebehaviors>       <behavior>         <datacontractserializer maxitemsinobjectgraph="2147483647"/>       </behavior>     </servicebehaviors>   </behaviors> 

it returns , deserializes large array without complaining...


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -