字节数组问题 [英] Byte Array Issue
问题描述
a:DeserializationFailed格式化程序尝试反序列化消息时引发异常:反序列化操作"ImageInsert"的请求消息正文时出错.读取XML数据时,已超出最大数组长度配额(16384).通过更改在创建XML阅读器时使用的XmlDictionaryReaderQuotas对象上的MaxArrayLength属性,可以增加此配额.第1行,位置63953.
尝试通过WCF服务传输图像时出现上述错误.
Webconfig文件:
a:DeserializationFailedThe formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation ''ImageInsert''. The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 63953.
I get the above error while trying to transfer a image through WCF Service.
Webconfig file :
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IImageTest" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
<readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
</configuration>
我的ServiceReference.Config文件是:
and my ServiceReference.Config file is:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IImageTest">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1177/ImageTest.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IImageTest" contract="ImageTest.IImageTest"
name="BasicHttpBinding_IImageTest" />
</client>
</system.serviceModel>
</configuration>
帮帮我
在此先感谢
Help me in this
Thanks in advance
推荐答案
增加maxItemsInObjectGraph配额.
Increase the maxItemsInObjectGraph quota.
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="6553600"/> <!--You can set this upto 2,147,483,647-->
</behavior>
这篇关于字节数组问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!