【发布时间】:2013-03-27 08:54:53
【问题描述】:
我正在使用一个 .NET、C# 应用程序,该应用程序打算将一个长 XML 字符串发送到 WCF 服务方法以进行进一步操作。当我的应用程序尝试在运行时将 XML 字符串发送到 WCF 服务时,我收到一条错误消息:
"The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:strProdUserDataXML. The InnerException message was '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 131, position 57.'. Please see InnerException for more details."
我的应用程序端 web.config 我已将“绑定”和“端点”编写为:
<binding name="EndPointHTTPGenericPortal" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<endpoint address="http://192.168.140.40/WcfGenericPortal_Service/Service1.svc" binding="basicHttpBinding" bindingConfiguration="EndPointHTTPGenericPortal" contract="IService1" name="EndPointHTTPGenericPortal" behaviorConfiguration="Graph" />
如果有任何机构可以帮助我解决这个错误,我将非常感激。 在此先感谢大家。
【问题讨论】:
-
你的服务器端网络配置是什么?
-
服务器端最大字符串内容长度配额的值是多少?
-
嗨,Voo & Jocke,感谢您的回复。服务器端配置是:'
' -
你的“readerQuotas”节点在哪里?
标签: c# .net wcf web-config quota