我在WCF中发送大数据时遇到错误 [英] I am getting below error while sending large data in WCF

查看:81
本文介绍了我在WCF中发送大数据时遇到错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在wcf中发送大数据量(120kb)时遇到错误.对于小尺寸数据,它可以正常工作,但无法发送大小超过100 KB的此类文件.
请找到错误详细信息和配置文件详细信息.

错误:-

错误:-向服务器发送响应时出错详细信息格式化程序尝试反序列化消息时引发异常:反序列化"CrawlResponse"操作的请求消息正文时出错.读取XML数据时,已超出最大数组长度配额(16384).通过更改在创建XML阅读器时使用的XmlDictionaryReaderQuotas对象上的MaxArrayLength属性,可以增加此配额.第1行,位置47721.
服务器堆栈跟踪:
在System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(消息回复,MessageFault错误,字符串操作,MessageVersion版本,FaultConverter faultConverter)
在System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime操作,ProxyRpc& rpc)处
在System.ServiceModel.Channels.ServiceChannel.Call处(字符串操作,布尔型单向,ProxyOperationRuntime操作,Object [] ins,Object [] outs,TimeSpan超时)
在System.ServiceModel.Channels.ServiceChannel.Call处(字符串操作,布尔型单向,ProxyOperationRuntime操作,Object [] ins,Object [] outs)
在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作)中
在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)
异常重新引发为[0]:
在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)
在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke处(MessageData& msgData,Int32类型)
在ICrawlResponse.CrawlResponse(Byte [] CrawlResult,Int32 ByteCount)
在Pricing.CrawlManager.Client.SendXmlData.SendData()中


请找到配置详细信息:-

Hi All,

I am getting below error while sending large data size (120kb) in wcf. For small size data it''s working fine but it fail to send such files having size more than 100 KB.
Please find the error details and Config file details.

Error :-

Error:- Error while sending response to server Details The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation ''CrawlResponse''. 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 47721.
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at ICrawlResponse.CrawlResponse(Byte[] CrawlResult, Int32 ByteCount)
at Pricing.CrawlManager.Client.SendXmlData.SendData()


Please find the Config details :-

<bindings>
 <basicHttpBinding>
 <binding name="BasicHttpBinding_ICrawlReceiver" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" 

bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 

maxBufferSize="65536" maxBufferPoolSize="5242880000" 

maxReceivedMessageSize="6553600" messageEncoding="Mtom" 

textEncoding="utf-8" transferMode="Streamed" 

useDefaultWebProxy="true">
  <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" 

maxNameTableCharCount="2147483647" /> 
 <security mode="None">
  <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> 
  <message clientCredentialType="UserName" algorithmSuite="Default" /> 
  </security>
  </binding>
  </basicHttpBinding>
  </bindings>
 <client>
  <endpoint address="http://70.84.215.66/Receiver/Receiver" 

binding="basicHttpBinding" 

bindingConfiguration="BasicHttpBinding_ICrawlReceiver" 

contract="localhost.ICrawlReceiver" 

name="BasicHttpBinding_ICrawlReceiver" /> 
  </client>
 <services>
 <service name="Pricing.CrawlManager.Server.ResponseProcessor" behaviorConfiguration="ServiceBehavior">
  <endpoint address="ResponseProcessor" binding="basicHttpBinding" contract="Pricing.CrawlManager.Communication.ICrawlResponse" />




请帮助我解决此类问题.

编辑TR:请使用< pre>标签使您的代码更清晰,包括XML.




Please help me to fix such issues.

Edit TR : Please used <pre> tags to make your code clearer, XML included.

推荐答案

该错误解决了错误,大声笑


The error solves the error lol read


basantakumar写道:
basantakumar wrote:

读取XML数据时,已超出最大数组长度配额(16384).通过更改在创建XML阅读器时使用的XmlDictionaryReaderQuotas对象上的MaxArrayLength属性,可以增加此配额.第1行

he 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


basantakumar写道:
basantakumar wrote:

最大数组长度配额(16384)已达到读取XML数据时超出限制.通过更改创建XML阅读器时使用的XmlDictionaryReaderQuotas对象的MaxArrayLength属性,可以增加此配额.

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.



在配置文件中增加这些值.它将解决您的问题.



Increase those values in config file.It''ll solve your problem.


HI,

This happens because of the size of response message i.e. when your service prepares the result into a byte[] as response to your request, it finds out that the "Maximum Array Length" is set to 16384 and since your response byte[] would be greater than this limit it throws an exception. In order to cure this problem, open the config file of the project where this WCF service is consumed – ServiceReferences.ClientConfig (Silverlight), app.config (WPF) or web.config(ASP.Net). Here you’ll see the binding settings of the service (please note: you may see multiple bindings, one for each service you have consumed. In this case, identify the binding of the service which is giving this exception)

check this link having solution of your problem

http://scorpiotek.com/blog/?p=393


这篇关于我在WCF中发送大数据时遇到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆