首页 > 其他 > 详细

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

时间:2014-10-14 18:50:30      阅读:396      评论:0      收藏:0      [点我收藏+]
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); 

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

原文:http://www.cnblogs.com/94cool/p/4024809.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!