0

I have a WCF web service which needs to returns a file (Can be returned by a byte array or by streaming). I was first returning a byte[] in the interface, which caused the client to go up to a 400MB memory usage (at peak) for a 100MB file. Since I need to reduce the client memory usage, I've added another interface which streams the file back to the client. This time, I witness a 600MB increase in the client (again, in peak). How can I reduce the client memory usage?

My current implementation of the server is as follows (streaming):

[ServiceContract]
public interface IOmriService
{
    [OperationContract]
    Stream GetAudio(string input);
}

App.config:

  <bindings>
    <basicHttpBinding>
       <binding name="HttpStreaming" maxReceivedMessageSize="67108864" transferMode="Streamed"/>
    </basicHttpBinding>
  </bindings>
Community
  • 1
  • 1
Omri
  • 1,058
  • 3
  • 14
  • 26
  • http://stackoverflow.com/questions/1519512/how-to-send-large-file-from-client-to-server-using-wcf and http://stackoverflow.com/questions/6030137/large-binary-byte-file-transfer-through-wcf – ilansch Sep 23 '13 at 16:27
  • I already read these posts and they suggest nothing different. My only issue is the RAM usage at the client side – Omri Sep 24 '13 at 05:47
  • Your client is receiving a large file ? during the data transfer, where does the client store the data ? if it receive 600MB file, and not saving in by chunks to the disc, it will remain in process memory no ? – ilansch Sep 24 '13 at 06:17
  • The client gets a 100MB file and keeps it memory. The problem is that the client memory usage comes up to 400MB at peak before reducing to around 100MB. – Omri Sep 24 '13 at 07:58
  • maybe this could help http://msdn.microsoft.com/en-us/library/ms733742.aspx – ilansch Sep 24 '13 at 08:29

1 Answers1

0

As far as I know there is no way of doing it in WCF. What I did was using a "simple" http file download. This consumes almost no memory by the client.

Omri
  • 1,058
  • 3
  • 14
  • 26