您的位置:首页 > 其它

Bytes to be written to the stream exceed the Content-Length bytes size specified 解决方法

2014-10-14 17:09 696 查看
context.Response.ContentType = encode;
using (StreamWriter writer = new StreamWriter(context.Response.OutputStream, UTF8))
{
writer.Write(str);
}上面代码常会报错:

Bytes to be written to the stream exceed the Content-Length bytes size specified

解决方法:

添加: context.Response.ContentLength64 = string.IsNullOrWhiteSpace(str) ? 0 : UTF8.GetByteCount(str);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐