none
Transfer huge data through WCF Service RRS feed

  • Question

  • Hi,

    I have been facing problems to transfer huge data from WCF service. What best ways to transfer huge? 

    I have a data of around 2GB and which is coming from SQL table with 270 columns and 90 thousand rows. To transfer this data through WCF service I tried following options but endup with memory outof rage errors. 

    1. Convert dataset data into xml string  and return string. Error:  System.outofmemoryException.

    2. Return dataset from service. Error:  Failed to allocate a managed memory buffer of 536870912 bytes. The amount of available memory may be low.

    3. Return Byte[]-- Convert dataset data into Byte[] and return. Error Failed to allocate a managed memory buffer of 536870912 bytes. The amount of available memory may be low.

    Following are my service web.config settings.

    Bindings:

     <binding name="extensionBasicHttpConf" closeTimeout="00:01:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" 
                     allowCookies="true" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" transferMode="StreamedResponse">
              <security mode="TransportWithMessageCredential">
                <message  clientCredentialType="UserName" algorithmSuite="Default" />
              </security>
            </binding>
    
            <binding name="mexHttpBinding">
              <security mode="TransportWithMessageCredential">
                <message  clientCredentialType="UserName" algorithmSuite="Default" />
              </security>
            </binding>

    Behaviors:

     <behavior name="PSIExtensionServiceBehavior">
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"  />
              <useRequestHeadersForMetadataAddress>
                <defaultPorts>
                  <add scheme="http" port="80" />
                  <add scheme="https" port="443" />
                </defaultPorts>
              </useRequestHeadersForMetadataAddress>
    
      </behavior>

    Endpoint:

    <service name="ABC.XYZ" behaviorConfiguration="PSIExtensionServiceBehavior">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="extensionBasicHttpConf" contract="ABC.IXYZ" />
            <endpoint address="mex" binding="basicHttpBinding" bindingConfiguration="mexHttpBinding" name="mex" contract="IMetadataExchange" />
          </service>


    Thanks, Ram

    Thursday, June 6, 2013 4:24 AM

Answers

  • Ciao ram kanumuri,

    You wrote on 06/06/2013 :

    I have a data of around 2GB and which is coming from SQL table with 270 columns and 90 thousand rows. To transfer this data through WCF service I tried following options but endup with memory outof rage errors.

    the first question should be: why the client need all that data?

    There is no "correct" answer to your scenario, the best approach is to:
    - request data in chunks;
    - or change the transport for that specific operation, e.g. moving to http;

    .m



    blog @ //milestone.topics.it
    Thursday, June 6, 2013 8:47 AM