title: How to stream large binary data to SQL Server
body: <p>I have a web service written in ASP.NET MVC with a SQL Server backend.  Clients can send large data in calls to the web service, in the order of 10's of megabytes each.</p>
  
  <p>On the server side I want to read the HTTP request stream and write it to VARBINARY field in a SQL table.  <strong>How can I do this without reading the entire stream into an in-memory array</strong>?</p>
  
  <p>The reason I am concerned about memory is that this system needs to scale to 1000's of concurrent clients (at least).</p>
  
  <p>I'm currently using Linq to SQL and it doesn't look like it supports streaming of data, because the Linq Binary type can only be initialized using a byte array.</p>
  
  <p>Is there some other way to do this using Linq to SQL?</p>
  
  <p>If this is not possible using Linq to SQL, how can I do this using ADO.NET or some other approach?</p>