Bytes to be written to the stream exceed the Content-Length bytes size specified 解决方法
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 解决方法的更多相关文章
- (转)HttpWebRequest以UTF-8编码写入内容时发生“Bytes to be written to the stream exceed the Content-Length bytes size specified.”错误
from:http://www.cnblogs.com/Gildor/archive/2010/12/13/1904060.html HttpWebRequest以UTF-8编码写入内容时发生“Byt ...
- failed to open stream: No such file or directory 报错解决方法
1.首先检查是否是文件名错误(比如有空格):是否因为路径不完整(比如缺少http://,或者缺少文件扩展名.doc等): 2.若是在本地中文名文件打开报错,我就是因为编码不一致导致: Windows中 ...
- 因用了NeatUpload大文件上传控件而导致Nonfile portion > 4194304 bytes错误的解决方法
今天遇到一个问题,就是“NeatUpload大文件上传控件而导致Nonfile portion > 4194304 bytes错误”,百度后发现了一个解决方法,跟大家分享下: NeatUploa ...
- mysqld-nt: Out of memory (Needed 1677720 bytes)解决方法
http://www.jb51.net/article/58726.htm 今天发现网站有点慢,发现mysql日志中提示mysqld-nt: Out of memory (Needed 1677720 ...
- mysql:1153 Got a packet bigger than ‘max_allowed_packet’ bytes的解决方法
备份还原或数据导入报错1153:Got a packet bigger than'max_allowed_packet'bytes的问题 这个问题可以有2个解决方法: 1.临时修改: mysql> ...
- Linux ubuntu 安装gcc、g++、 pcre、zlib、ssl、nginx和该内存不能为written解决方法
1.楼主也是第一次接触Linux 如果有错误的地方还请各位朋友指出.... 2.gcc.g++依赖库:sudo apt-get install build-essential,sudoapt-get ...
- python3.x执行post请求时报错“POST data should be bytes or an iterable of bytes...”的解决方法
使用python3.5.1执行post请求时,一直报错"POST data should be bytes or an iterable of bytes. It cannot be of ...
- Got a packet bigger than‘max_allowed_packet’bytes错误的解决方法
通常项目上线前都有一些初始化数据需要导入,在今天博客系统发布前我使用sqlyog工具远程登录服务器的Mysql数据库,执行sql脚本对初始数据进行导入的时候报错: Got a packet bigge ...
- Oracle:environment variable "PATH" does not exceed the recommended length
今天重新安装oracle11g,突然在检测时报了以下错误: Environment variable: "PATH" - This test checks whether the ...
随机推荐
- MapReduce实战(五)实现关联查询
需求: 利用MapReduce程序,实现SQL语句中的join关联查询. 订单数据表order: id date pid amount 1001 20150710 P0001 2 1002 20150 ...
- SpringBoot 获取前端页面参数的集中方式总结
SpringBoot的一个好处就是通过注解可以轻松获取前端页面的参数,之后尅将参数经过一系列处理传送到后台数据库,前端时间正好用到.大致分为一下几种: 1.指定前端URL请求参数名称与方法名称一致,这 ...
- input取值
----------------------------1------------------------------ <span class="lv-a-right" id ...
- 自己编写Android Studio插件 别停留在用的程度了(转载)
转自:自己编写Android Studio插件 别停留在用的程度了 1概述 相信大家在使用Android Studio的时候,或多或少的会使用一些插件,适当的配合插件可以帮助我们提升一定的开发效率,更 ...
- 如何获得<div id=”div1”>This is first layer</div>中的值?
如何获得<div id=”div1”>This is first layer</div>中的值? 解答: <script> var div1=Document.ge ...
- 关闭ReSharper中的[ Use 'var' ]提示(Disable C# “var” Recommendation in ReSharper)
ReSharper,确实是个很不错的工具,代码如果写得不规范他会提示,而且可以根据自己公司的需求自定义代码规范. 默认设置的提示已经相当完美,但美中不足就是老提示你用var来代替所有类型. 按以下步骤 ...
- 【分享】DevDocs API Documentation
http://devdocs.io/ 这是一份综合性的在线API列表,很全,方便查找.
- 移动端web页面上滑加载更多功能
背景介绍: 开发企业微信的一个应用,实现在企业微信中调用自己程序页面,页面加载多模块数据,向下滑加载更多,等等等等,一波三折 然后很早就成功了是这样实现的: html: <div id=&quo ...
- 160728、Spark Streaming kafka 实现数据零丢失的几种方式
定义 问题开始之前先解释下流处理中的一些概念: At most once - 每条数据最多被处理一次(0次或1次) At least once - 每条数据最少被处理一次 (1次或更多) Exactl ...
- delphi---EHlib第三方插件----TDBGridEH,TDBNumberEditEh,TDBComboBoxEh
一.TDBGridEH 1.多选 行 options->dgMultiSelect 2.列字体改变颜色,OnDrawColumnCell写下方法. if Column.FieldName='价格 ...