格式化程序在尝试反序列化消息时抛出异常:尝试反序列化参数http://tempuri.org/:GetFileResult时出错。 InnerException消息是'反序列化WindowsClient.CloudServiceProxy.GetFileResponse类型的对象时出错。读取XML数据时已超出最大数组长度配额(16384)。通过更改创建XML阅读器时使用的XmlDictionaryReaderQuotas对象上的MaxArrayLength属性,可以增加此配额。第1行,位置41572.'。有关更多详细信息,请参阅InnerException。 我正在接受这个问题 sever web.config是
<system.serviceModel>
<services>
<service behaviorConfigura
tion="CloudServiceBehaviour" name="Web.CloudService">
<endpoint name="CloudServiceClientEndPoint" bindingConfiguration="CloudBindingConfig" address="http://localhost:53243/CloudService.svc" binding="wsHttpBinding" contract="Web.ICloudService"></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="CloudServiceBehaviour">
<serviceMetadata httpGetEnabled="True" httpGetUrl=""/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="CloudBindingConfig" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="200" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
和客户端web.config是,
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="CloudServiceClientEndPoint" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:30:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:53243/CloudService.svc" binding="wsHttpBinding"
contract="CloudServiceProxy.ICloudService" name="CloudServiceClientEndPoint" />
</client>
</system.serviceModel>
答案 0 :(得分:2)
由于错误是在反序列化GetFileResponse
对象时,这告诉您问题出在客户端堆栈中。
您的客户端绑定使用wsHttpBinding的默认配置,因为您已省略在端点上指定bindingConfiguration名称。尝试将bindingConfiguration="CloudServiceClientEndPoint"
添加到端点元素,然后将获取readerQuotas设置的大值。