title: How to transfer a large Zip file (50MB) using a WCF Service through SOAP to any client?
body: <p>I have a WCF Service that returns a byte array with a Zip file (50MB) to any client that requests it. If the Zip is very small (say 1MB), the SOAP response is coming from WCF with the byte array embedded in it. But the response size is very huge even for a 1MB file. If I try to transfer the 50MB file the service hangs and throws an out of memory exception, because the SOAP response becomes huge in size.</p>
  
  <ol>
  <li><p>What is the best option available with WCF / web service to transfer large files (mainly ZIP format) as I am sending back a byte array. Is there any good approach instead of that for sending back the file? </p></li>
  <li><p>Whether WCF / web service is best way to transfer large files to any client or is there any other better option/technology available so that interoperability and scalability for 10,000 users can be achieved? </p></li>
  </ol>
  
  <p>My Ccode is below:</p>
  
  <pre><code>        String pathfordownload = @"D:\New Folder.zip";
          FileStream F2D = new FileStream(pathfordownload, FileMode.Open,FileAccess.Read);
          BinaryReader binReader = new BinaryReader(F2D);
          binReader.BaseStream.Position = 0;
          byte[] binFile = binReader.ReadBytes(Convert.ToInt32 (binReader.BaseStream.Length));
          binReader.Close();
          return binFile;
  </code></pre>
  
  <p>A working piece/real piece of information will be really helpful as I am struggling with all the data available in Google and have had no good results for last week.</p>