流写大字节数组

时间:2017-08-03 13:35:56

标签: c# arrays stream

我试图在http请求流中写一个巨大的字节数组 这是我的代码:

ASCIIEncoding encoding = new ASCIIEncoding();
byte[] bytes = encoding.GetBytes(body);

request.ContentType = contentType;
request.ContentLength = bytes.Length;

Stream stream = request.GetRequestStream();
stream.Write(bytes, 0, bytes.Length);
stream.Close();

它适用于小文件,但是当我尝试ti写字节数组[9264619]时,我收到了一个中止错误。 有什么建议吗?

0 个答案:

没有答案
相关问题