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 ...
随机推荐
- HDU 4982 Goffi and Squary Partition(推理)
HDU 4982 Goffi and Squary Partition 思路:直接从全然平方数往下找,然后推断是否能构造出该全然平方数,假设能够就是yes,假设都不行就是no.注意构造时候的推断,因为 ...
- Cocos性能优化工具的开发介绍Visual Studio内存泄漏检测工具——Visual Leak Detector
然后,Windows下有什么好的内存泄漏检測工具呢?微软提供Visual Studio开发工具本身没有什么太好的内存泄漏检測功能.我们能够使用第三方工具Visual Leak Detector(下面简 ...
- vim代码折叠命令简短
作者:zhanhailiang 日期:2014-10-18 1. 通过fdm实现代码折叠:set fdm=xxx 有下面6种方式实现折叠: |fold-manual| manual Folds are ...
- doc-remote-debugging.html
https://studio.zerobrane.com/doc-remote-debugging.html
- JavaScript动漫作品(闭幕)
笔者:Steven Riche 发布时间:2014年2一个月18 原文链接:http://code.tutsplus.com/tutorials/javascript-animation-that-w ...
- js缓冲运动
缓冲运动 现象:逐渐变慢,最后停止 原理:距离越远,速度越大 速度的计算方式: 1,速度由距离决定 2,速度=(目标值-当前值)/缩放系数 说明:速度为正负数时,也决定了物体移动的方向 示例:div缓 ...
- swing中几种layout示例(转)
import java.awt.BorderLayout;import java.awt.FlowLayout;import java.awt.GridLayout;import java.awt.e ...
- ** poj Y2K Accounting Bug 2586
Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10117 Accepted: 50 ...
- MyBatis系列教程(六)-- 与Spring综合(Integrate with Spring)
其它工具或技术需要使用: 项目管理工具 : Maven 前台WEB图库:JSP 其他框架:Spring, Spring MVC 数据库 : Derby Maven的Web项目 Maven Depend ...
- servlet(jsp)中的重定向和转发
servlet(jsp)中的重定向和转发 由一个servlet(jsp)从内部转向还有一个servlet(jsp)有两种方式:转发和重定向. 转发:是由一个web组件(servlet)将未完毕的处理交 ...