gpt4 book ai didi

.net - WCF - 赢取应用程序 “The maximum string content length quota (8192) has been exceeded while reading XML data.”

转载 作者:行者123 更新时间:2023-12-04 05:14:54 25 4
gpt4 key购买 nike

我在通过 WCF 实现 Web 服务时遇到了一些问题。当我从客户端应用程序将 WCF 方法中的值作为字符串 (xml) 传递时,出现错误

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:XmlEntity.


InnerException消息是

'There was an error deserializing the object of type System.String. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 249, position 19.'.



我试图在客户端 web.configuration 文件中更改 maxStringContentLength 的值,但错误仍然相同。请尝试尽快找出解决方案。

最佳答案

Ashish,Darin 的意思是您应该创建一个 basicHttpBinding 来覆盖并将 maxStringContentLength 的值增加到 2147483647。您能否确认您是否已将端点配置为使用具有 bindingConfiguration 属性的相同 binidng。例如,您创建了这样的绑定(bind),

<basicHttpBinding>
<binding name="HandleLargeMessage" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>

您可以像这样配置端点以使用上述绑定(bind)配置,(请注意 bindingConfiguration 属性)
<endpoint  
address="....."
binding="basicHttpBinding" bindingConfiguration="HandleLargeMessage"
contract="xxx" />

你能确认你是否已经这样做了吗?很可能这里似乎并非如此。

如果您已经按照此操作并想确认它是否已被使用,请在详细级别捕获服务和客户端应用程序的 WCF 跟踪,并检查在服务端构造主机和在客户端应用程序构造 channel 中的事件。

关于.net - WCF - 赢取应用程序 “The maximum string content length quota (8192) has been exceeded while reading XML data.”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4906128/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com