none
transfer large data from wcf service to client RRS feed

  • Question

  • i have an wcf service in which i have 10000 records to transfer when client call its every time i got some exception plz give me demo to transfer large data
    Monday, February 24, 2014 9:39 AM

Answers

  • Hi,

    By default the data in wcf service can be transfer is 64kb, so in order to transfer some large data, we need to do some binding config, please try to check the following:

      <netTcpBinding>
        <binding name="netTcpBindingConfig" closeTimeout="00:10:00" openTimeout="00:10:00" 
            receiveTimeout="0:10:00" sendTimeout="00:10:00" 
            hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxConnections="10"
            maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
            transferMode="Streamed">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
    </netTcpBinding>

    And please do not forget to apply this binding config to the endpoint as following:

    <endpoint address="net.tcp://......" 
              binding="netTcpBinding" 
              bindingConfiguration="netTcpBindingConfig" 
              contract="Yoursevicecontract" />

    For more information, please try to refer to:
    How to transfer large data in WCF:
    http://nagavitalp.blogspot.com/2011/04/transfer-large-messages-in-wcf-part-1.html .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, February 25, 2014 5:58 AM
    Moderator

All replies

  • Hi,

    By default the data in wcf service can be transfer is 64kb, so in order to transfer some large data, we need to do some binding config, please try to check the following:

      <netTcpBinding>
        <binding name="netTcpBindingConfig" closeTimeout="00:10:00" openTimeout="00:10:00" 
            receiveTimeout="0:10:00" sendTimeout="00:10:00" 
            hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxConnections="10"
            maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
            transferMode="Streamed">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
    </netTcpBinding>

    And please do not forget to apply this binding config to the endpoint as following:

    <endpoint address="net.tcp://......" 
              binding="netTcpBinding" 
              bindingConfiguration="netTcpBindingConfig" 
              contract="Yoursevicecontract" />

    For more information, please try to refer to:
    How to transfer large data in WCF:
    http://nagavitalp.blogspot.com/2011/04/transfer-large-messages-in-wcf-part-1.html .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, February 25, 2014 5:58 AM
    Moderator
  • You may have to increase the timeout.  Not sure.  10,000 row from a database is a relatively small amount of data and you only have to increase the timeout if it is taking more than 5 minutes.  But if your rows contains a lot of bytes then you may be reaching the standard timeouts.  How long does it take before you get the exception?  Can you post the StackTrace from the exception?

    jdweng

    Tuesday, February 25, 2014 6:21 AM