当我将实体对象传递给WebService时,我收到以下错误
读取XML数据时已超出最大字符串内容长度配额(8192)。通过更改创建XML阅读器时使用的XmlDictionaryReaderQuotas对象的MaxStringContentLength属性,可以增加此配额
我尝试通过在Webservice的webconfig中提供以下代码来解决此问题,但错误仍然存在。任何人都可以帮助!!!!!
<bindings>
<wsHttpBinding>
<binding name="MyService" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
答案 0 :(得分:3)
您必须在服务器和客户端上设置最大字符串内容长度配额。所以检查你的客户端配置。如果这不起作用,请检查您是否使用了正确的绑定。
答案 1 :(得分:0)
您的服务器端Web配置允许使用大字符串,但您还需要修改客户端ServiceReferences.ClientConfig文件以反映该字符串。
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="Binding_MyService">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="yourserviceurlhere"
binding="wsHttpBinding" bindingConfiguration="Binding_MyService"
contract="yourcontracthere" name="MyService" />
</client>
</system.serviceModel>