您的位置:首页 > 其它

WebService出错 Maximum message size quota for incoming messages (65536) has been exceeded.已超过传入消息(65536)的最大消息大小配额

2017-02-18 16:05 465 查看
转自海乐学习原文WebService出错 Maximum message size quota for incoming messages (65536) has been exceeded.已超过传入消息(65536)的最大消息大小配额

问题1:WebService出错 Maximum message size quota for incoming messages (65536) has been exceeded.

今天下午在网上一直搜索解决方案将近2个小时,人要崩溃了,除了StackOverflow上的洋文有些信息外,国内几乎不见踪影。十分苦恼,英语看起来十分费劲,也没有给出直接的解决方案。后来在看到了海乐学习的一篇文章,先将其整理过来,以飨读者。

问题的根本原因正如错误异常说明的那样,起始方法上面也说了,只是对于新人来说,你根本不知道在哪里进行设置。其实就是在app.config中的下面,设置一下请求的一些参数的数值。

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ServerUpdaterSoap" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="64" maxStringContentLength="8192000" maxArrayLength="16384000"
maxBytesPerRead="4096000" maxNameTableCharCount="16384000" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:3604/ServerUpdater.asmx"
binding="basicHttpBinding" bindingConfiguration="ServerUpdaterSoap"
contract="WebReferenceUpdater.ServerUpdaterSoap" name="ServerUpdaterSoap" />
</client>
</system.serviceModel>
</configuration>


View Code

2:读取 XML 数据时,超出最大字符串内容长度配额 (8192)。通过更改在创建 XML 读取器时所使用的 XmlDictionaryReaderQuotas 对象的 MaxStringContentLength 属性,可增加此配额。 第 211 行,位置为 394。

解决办法:

也是修改Web.Config中的MaxStringContentLength ,这是有些数据比较长的时候出现这个问题,改大一点就可以了吧。

<readerQuotas maxDepth="64" maxStringContentLength="8192000" maxArrayLength="16384000"
maxBytesPerRead="4096000" maxNameTableCharCount="16384000" />
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐