我想将大于 800 mb 的大文件发送到 cassansdra 存储。但我收到 System.OutOfMemoryException。
请在下面找到代码:
HttpWebRequest request = WebRequest.Create(postUrl) as HttpWebRequest;
Stream requestStream = request.GetRequestStream();
byte[] buffer = new byte[8 * 1024];
int len;
while ((len = fileToUpload.File.Read(buffer, 0, buffer.Length)) >0)
{
requestStream.Write(buffer, 0, len);
requestStream.Flush();
}
return request.GetResponse() as HttpWebResponse;
请建议我代码的哪一部分需要改进?
fileToUpload 是来自 UI 的 800 MB 的确切流。