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 ...
随机推荐
- 《深入了解Android:Wi-Fi、NFC和GPS音量》勘误表
资源下载更新(我不知道为什么被115网盘屏蔽) 深入了解android它wifi-nfc-gps 115网盘礼包码:5lbee5qn4g5ghttp://115.com/lb/5lbee5qn4g5g ...
- hadoop-1.1.2 在Windows环境下的部署
1:先安装Cygwin 参考http://blog.csdn.net/wind520/article/details/9223003 2:下载 3:解压在C:\cygwin\hadoop1 4:配置 ...
- ROM签名脚本[原创]
下面的代码是bash脚本来的.需要保存为*.sh后序. # !/bin/bash #usage: signapk.sh [-hs] [zipfile-unsigned | update.zip] #A ...
- 重新想象 Windows 8 Store Apps (26) - 选取器: 自定义文件选取窗口, 自定义文件保存窗口
原文:重新想象 Windows 8 Store Apps (26) - 选取器: 自定义文件选取窗口, 自定义文件保存窗口 [源码下载] 重新想象 Windows 8 Store Apps (26) ...
- (一个)kafka-jstorm集群实时日志分析 它 ---------kafka实时日志处理
package com.doctor.logbackextend; import java.util.HashMap; import java.util.List; import java.util. ...
- HttpClient文件上传下载
1 HTTP HTTP 协议可能是如今 Internet 上使用得最多.最重要的协议了,越来越多的 Java 应用程序须要直接通过 HTTP 协议来訪问网络资源. 尽管在 JDK 的 java.net ...
- 为什么MVC不是一种设计模式(转)
MVC(Model-View-Controller)是处理界面应用程序时常用的解决方案,构成了表示层. MVC通过分离模型.视图.控制器在应用程序中的角色,实现界面和业务逻辑的解耦.Model(是OO ...
- telnet发电子邮件
无聊今天的工作,想想一个学生被提到最后一次telnet发电子邮件,所以我想试试.最后,成功的实践,这里做个总结. 首先,cmd进telnet打开回话: 下面红色字体为命令. 1.open smtp.1 ...
- Tomcat—怎样在Tomcat Webserver下部署Web项目
总结一下怎样在Tomcat Webserver下部署Web项目:
- RH133读书笔记(9)-Lab 9 Installation and System-Initialization
Lab 9 Installation and System-Initialization Goal: Successfully install Red Hat Enterprise Linux. Sy ...