WCF:反序列化操作超出最大数组长度配额(16384),但是我已经设置了,为何没有起作用?

y740504 2013-02-28 01:34:26
反序列化操作“GetByteADAttr”的响应消息的正文时出现错误。读取 XML 数据时,超出最大数组长度配额(16384)。通过更改在创建 XML 读取器时所使用的 XmlDictionaryReaderQuotas 对象的 MaxArrayLength 属性,可增加此配额。 行 1,位置 55177

错误如上:
服务端配置:
<system.serviceModel>
<services>
<service behaviorConfiguration="PmsServiceBehaviors" name="PmsWcfServer.PmsWcfBaseData">
<endpoint address="" behaviorConfiguration="EndPointBehaviors" binding="netTcpBinding" bindingConfiguration="BindClientTcp" name="PmsPartBaseTcp" bindingName="PmsWcfServer.IPmsWcfBaseData" contract="PmsWcfServer.IPmsWcfBaseData" />
<endpoint address="mex" binding="mexTcpBinding" name="PmsPartBaseTcpMex" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8080/Base" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="EndPointBehaviors">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="PmsServiceBehaviors">
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceMetadata httpGetEnabled="false" />
<serviceCredentials>
<serviceCertificate findValue="PmsWcfServer" x509FindType="FindBySubjectName" />
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="PmsWcfServer.CheckUserNamePass,PmsWcfServer" />
</serviceCredentials>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="BindClientTcp" closeTimeout="00:30:00" openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession inactivityTimeout="00:30:00" />
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>

<binding name="BindingServerTcp" closeTimeout="00:30:00" openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="3200" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession inactivityTimeout="00:30:00" />
<security mode="None">
<transport clientCredentialType="None" />
<message clientCredentialType="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>

客户端的配置:

<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="PmsPartBaseTcp" closeTimeout="01:30:00" openTimeout="01:30:00"
receiveTimeout="01:30:00" sendTimeout="01:30:00" transactionFlow="true"
transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="01:30:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:8080/System" binding="netTcpBinding"
bindingConfiguration="PmsPartBaseTcp" contract="WcfSystem.IPmsWcfSystem"
name="PmsSystemTcp">
<identity>
<certificate encodedValue="AwAAAAEAAAAUAAAAPVYZAlhMWK7qe8T9yHAWDFYiemUgAAAAAQAAAPsBAAAwggH3MIIBZKADAgECAhBlMZOc+p9SuUFWnLbCdeUPMAkGBSsOAwIdBQAwFzEVMBMGA1UEAxMMUG1zV2NmU2VydmVyMB4XDTExMDQxOTE1NTE0NFoXDTM5MTIzMTIzNTk1OVowFzEVMBMGA1UEAxMMUG1zV2NmU2VydmVyMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDWG1vE5XBPoC0GLWoxOJc/p34Wnp3l1TutV2HpPskRzceD/NhEeReuDsJW4uxGUeEGrUez6pHQrSHLWj84bkr+09K62gScffa4Mf1jsZoOr24TK3Hzx5C5BWlFkUUCCSX4VwWn7c8kDVJZyp9rcfsz4WtaZaG39LRv7uH3PuHXmQIDAQABo0wwSjBIBgNVHQEEQTA/gBD8Sa5F80dy+mpoOlyXmWLjoRkwFzEVMBMGA1UEAxMMUG1zV2NmU2VydmVyghBlMZOc+p9SuUFWnLbCdeUPMAkGBSsOAwIdBQADgYEARyp4SNJTE0pwBTmzs2m31sDLnoIObbmfy7cf+WYmlwesYZZZokCun+8YBetNgNmXa9HUFyCLzGM+uHcE6Qkjk5SjCqnugq7RiKIjRrpbgPzQPCMriHn4GBkbMCD1iDbfVRdge1Vg8oth3Sd0Xi7jGTbhxi65I4+vmFPUro1FnSE=" />
</identity>
</endpoint>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="WcfBase">
<clientCredentials>
<serviceCertificate>
<authentication certificateValidationMode="None"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
...全文
221 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
gxingmin 2013-02-28
  • 打赏
  • 举报
回复
把配置文件里的MaxArrayLength 值改大些试试

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧