这是我的app.config->
<bindings>
<basicHttpBinding>
<binding messageEncoding="Mtom" />
<binding name="requestPTPDocumentForInvBasketSchemaSoap11" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="409600"
maxBytesPerRead="409600" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<customBinding>
<binding name="CustomBindingEndPoint">
<textMessageEncoding messageVersion="Soap11WSAddressing10" />
<security defaultAlgorithmSuite="TripleDesRsa15" authenticationMode="MutualCertificate"
securityHeaderLayout="Lax" includeTimestamp="false" messageProtectionOrder="SignBeforeEncrypt"
messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
<issuedTokenParameters keyType="AsymmetricKey" />
<localClientSettings detectReplays="false" />
<secureConversationBootstrap />
</security>
<httpTransport maxReceivedMessageSize="2147483647" />
</binding>
</customBinding>
</bindings>'
我收到的错误是 ->{“读取 XML 数据时超出了“每次读取操作的最大字节数”配额 (4096)。长元素开始标记(由元素名称、属性名称和属性值组成)可能会触发此配额。可以通过更改创建 XML 读取器时使用的 XmlDictionaryReaderQuotas 对象上的 MaxBytesPerRead 属性来增加此配额。第 1 行,位置 5305。” 在使用 JAVA Web 服务时,我收到上述错误。请提出建议
最佳答案
遇到这个老问题寻找同样的东西。找到这篇文章:https://social.msdn.microsoft.com/Forums/vstudio/en-US/b7d25a12-529c-4217-b7bd-d4b35be608ed/how-to-increase-maxbytesperread-and-related-properties-in-code?forum=wcf建议将 ReaderQuotas.MaxBytesPerRead 设置为较高的数字,例如 409600,因为显然 int.MaxValue 不被接受。更改建议值解决了我的问题。
关于.net - "The ' 读取 XML 数据时超出了每个读取操作配额 (4096) 的最大字节数。长元素开始标签可能会触发此配额,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23751926/