The maximum string content length quota (8192) has been exceeded while reading XML data
原文:The maximum string content length quota (8192) has been exceeded while reading XML data
问题场景:在我们WCF服务发布后,我们要确保服务端以及客户端的配置文件允许合适大小的传输设置。笔者在发布WCF服务时,服务端的绑定未做传输大小的设置(采用了默认,maxStringContentLength默认大小为8192),而我们在传输序列化的数据时,大小超过了这个限制。
读取 XML 数据时,超出最大字符串内容长度配额 (8192)。通过更改在创建 XML 读取器时所使用的 XmlDictionaryReaderQuotas 对象的 MaxStringContentLength 属性,可增加此配额。
问题原因:服务端或者客户端关于传输大小的未做设置,maxStringContentLength默认大小为8192,实际传输大于8192,由此产生异常。
解决方案:
1.确定是客户端还是服务端的限制。
2.在客户端或服务器的做如下配置:
<binding name="xxx" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> security> </binding>
代码中可修改如下:
MyServiceClient service = null;
//MyServiceClient service = new MyServiceClient();
try
{ System.ServiceModel.Channels.CustomBinding bing = new System.ServiceModel.Channels.CustomBinding(
new System.ServiceModel.Channels.BindingElement[]{
new BinaryMessageEncodingBindingElement(){ ReaderQuotas= new System.Xml.XmlDictionaryReaderQuotas {
MaxDepth=,
MaxStringContentLength=,
MaxArrayLength=,
MaxBytesPerRead=}},
new HttpTransportBindingElement()
}); bing.Name = "CustomBinding_DataService";
EndpointAddress address = new EndpointAddress(http://www.xxx.com/MyService.svc); service = new MyServiceClient(bing, address); }
catch (Exception ex)
{
throw ex;
}
The maximum string content length quota (8192) has been exceeded while reading XML data的更多相关文章
- WCF常见异常-The maximum string content length quota (8192) has been exceeded while reading XML data
异常信息:The maximum string content length quota (8192) has been exceeded while reading XML data 问题:调用第三 ...
- 调用WebServiceWebService提示The maximum string content length quota (8192) has been exceeded while reading XML data的解决办法
在web.config中,bindings节点下,对应的服务名称中,原本可能是自动折叠的“/>”,需要改成手动折叠的</binding>,然后在中间加上<readerQuota ...
- [Bug]The maximum array length quota (16384) has been exceeded while reading XML data.
写在前面 在项目中,有客户反应无法正常加载组织结构树,弄了一个测试的程序,在日志中查看到如下信息: Error in deserializing body of reply message for o ...
- WCF服务接口多,客户端在引用时出错!报WCF The maximum nametable character count quota (16384) has been exceeded while reading XML data错误
WCF服务接口多,客户端在引用时出错!报WCF The maximum nametable character count quota (16384) has been exceeded while ...
- String Matching Content Length
hihocoder #1059 :String Matching Content Length 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 We define the ...
- ics httpDELETE 时增加 content,length 特别需求
unit: OverbyteIcsHttpProt.pasprocedure THttpCli.SendRequest(const Method, Version: String); var Head ...
- String.length()和String.getBytes().length
1.字符与字节 抛出如下代码: public static void main(String[] args) { String str = "活出自己范儿"; System.out ...
- ord() expected string of length 1, but int found
源代码是这样: s=b'^SdVkT#S ]`Y\\!^)\x8f\x80ism' key='' for i in s: i=ord(i)-16 key+=chr(i^32) prin ...
- 定时器setInterval, innerText获取文本, charAt()获取单个字符串, substring(1, content.length)获取范围内的字符串, 实现字符串的滚动效果
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
随机推荐
- 【ThinkingInC++】8、说明,浅谈数据类型的大小
/** * 特征:说明.浅谈数据类型的大小 * 时刻:2014年8一个月10日本11:02:02 * 笔者:cutter_point */ #include<iostream> using ...
- 重新想象 Windows 8 Store Apps (22) - 文件系统: 访问文件夹和文件, 通过 AQS 搜索本地文件
原文:重新想象 Windows 8 Store Apps (22) - 文件系统: 访问文件夹和文件, 通过 AQS 搜索本地文件 [源码下载] 重新想象 Windows 8 Store Apps ( ...
- 使用Intellij Idea生成可执行文件jar,开关exe文件步骤
确保其Java代码是没有问题的,在IDEA常执行的,然后.按以下步骤: 步骤一:打开File -> Project Structure -> Artifacts,例如以下图 步骤二:点击& ...
- Flex发行2048游戏
近来的2048像挺火的游戏.在公交车,吃.甚至还有人走在路上拿着手机在玩.之前我看我的同事们戏,我认为这是很天真,中移动太无聊了吧 到后面,他是在,我觉得真的很无聊,这时候,无聊的时候无聊,后来我想用 ...
- 几款开源ESB总线的比较(转)
现有的开源ESB总线中,自从2003年第一个开源总线Mule出现后,现在已经是百花争鸣的景象了.现在我就对现有的各种开源ESB总线依据性能.可扩展性.资料文档完整程度以及整合难易程度等方面展开. CX ...
- all about AIX MPIO
Multipath I/O (多路径) 在计算机存储技术里,多路径提供了容错和性能提高,在计算机系统里CPU有多条物理路径通道,块存储设备通过总线,控制器,交换设备以及桥接设备来连接. ...
- Vim经常使用技巧总结1
我的主力博客:半亩方塘 1. 反复上次的操作在普通模式下用 . 命令 2. 取消上次的操作在普通模式下用 u 命令 3. 整行删除在普通模式下用 dd 命令,此命令在删除行后 不进入插入模式 4. 整 ...
- java中三种常见内存溢出错误的处理方法(good)
相信有一定java开发经验的人或多或少都会遇到OutOfMemoryError的问题,这个问题曾困扰了我很长时间,随着解决各类问题经验的积累以及对问题根源的探索,终于有了一个比较深入的认识. 在解决j ...
- linux下getsockopt和setsockopt具体解释及測试
linux下getsockopt和setsockopt具体解释及測试 NAME 名字 getsockopt, setsockopt - get and set options on sockets 获 ...
- [Java Web]Struts2加起来(一个)
Struts2环境配置 进口Struts2的需要jar包 在WEB-INF/classes(src)文件夹下创建struts.xml文件 在web.xml文件里加入Struts过滤器信息 经常使用配置 ...