仅当服务返回FaultException< T>时,QuotaExceededException.其中T是一个相当大的对象 [英] QuotaExceededException only when service returns a FaultException<T> where T is a rather big object

查看:80
本文介绍了仅当服务返回FaultException< T>时,QuotaExceededException.其中T是一个相当大的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当服务通过FaultException< T>返回对象时,我收到QuotaExceededException.如果WCF操作的结果直接返回了同一对象,则一切工作正常.有任何想法吗?

I receive a QuotaExceededException when the service returns an object via FaultException<T>. If the same object is returned directly as the result of the WCF Operation, then everything works perfectly. Any Idea ?

这是堆栈跟踪:

----例外----
[QuotaExceededException]缓冲XML内容所需的大小超出了缓冲区配额.

---- Exception ----
[QuotaExceededException] The size necessary to buffer the XML content exceeded the buffer quota.

服务器堆栈跟踪:
  在System.ServiceModel.Channels.BufferedOutputStream.WriteCore(Byte []缓冲区,Int32偏移量,Int32大小)
  在System.ServiceModel.Channels.BufferedOutputStream.Write处(字节[]缓冲区,Int32偏移量,Int32大小)
  在System.Xml.XmlStreamNodeWriter.FlushBuffer()
  在System.Xml.XmlBinaryNodeWriter.FlushBuffer()
  在System.Xml.XmlStreamNodeWriter.GetBuffer(Int32 count,Int32& offset)
  在System.Xml.XmlStreamNodeWriter.UnsafeWriteUTF8Chars(Char * chars,Int32 charCount)
  在System.Xml.XmlBinaryNodeWriter.UnsafeWriteName(Char * chars,Int32 charCount)
  在System.Xml.XmlBinaryNodeWriter.WriteName(String s)
  在System.Xml.XmlBinaryNodeWriter.WriteXmlnsAttribute(字符串前缀,字符串ns)处
  在System.Xml.XmlBaseWriter.NamespaceManager.DeclareNamespaces(XmlNodeWriter writer)处
  在System.Xml.XmlBaseWriter.WriteEndElement()
  在System.Xml.XmlDictionaryWriter.WriteElementNode(XmlDictionaryReader reader,Boolean defattr)中
  在System.Xml.XmlDictionaryWriter.WriteNode(XmlDictionaryReader reader,Boolean defattr)中
  在System.ServiceModel.Channels.ReceivedFault.CreateFault11(XmlDictionaryReader reader,Int32 maxBufferSize)中
  在System.ServiceModel.Channels.MessageFault.CreateFault(消息,Int32 maxBufferSize)
  在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消息)处

Server stack trace:
   at System.ServiceModel.Channels.BufferedOutputStream.WriteCore(Byte[] buffer, Int32 offset, Int32 size)
   at System.ServiceModel.Channels.BufferedOutputStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.Xml.XmlStreamNodeWriter.FlushBuffer()
   at System.Xml.XmlBinaryNodeWriter.FlushBuffer()
   at System.Xml.XmlStreamNodeWriter.GetBuffer(Int32 count, Int32& offset)
   at System.Xml.XmlStreamNodeWriter.UnsafeWriteUTF8Chars(Char* chars, Int32 charCount)
   at System.Xml.XmlBinaryNodeWriter.UnsafeWriteName(Char* chars, Int32 charCount)
   at System.Xml.XmlBinaryNodeWriter.WriteName(String s)
   at System.Xml.XmlBinaryNodeWriter.WriteXmlnsAttribute(String prefix, String ns)
   at System.Xml.XmlBaseWriter.NamespaceManager.DeclareNamespaces(XmlNodeWriter writer)
   at System.Xml.XmlBaseWriter.WriteEndElement()
   at System.Xml.XmlDictionaryWriter.WriteElementNode(XmlDictionaryReader reader, Boolean defattr)
   at System.Xml.XmlDictionaryWriter.WriteNode(XmlDictionaryReader reader, Boolean defattr)
   at System.ServiceModel.Channels.ReceivedFault.CreateFault11(XmlDictionaryReader reader, Int32 maxBufferSize)
   at System.ServiceModel.Channels.MessageFault.CreateFault(Message message, Int32 maxBufferSize)
   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)

 

推荐答案

肯定存在正常和错误返回的对象的大小差异(在您的情况下) T).因此,请增加readerQuotas的大小,以下标记显示默认值.请增加maxStringContentLenght和 maxArrayLength.

Defintely there must be size difference of the object which is returned by normal and through fault (in your case T). So Kindly increase the size of readerQuotas, the below tags shows the default values., Kindly increase the maxStringContentLenght and maxArrayLength.

< readerQuotas               maxDepth = " ; 32;  
           
maxStringContentLength = " ; 8192"  
           
maxArrayLength = " ; 16384"  
           
maxBytesPerRead = " ; 4096"  
           
maxNameTableCharCount = " ; 16384"

<readerQuotas              maxDepth="32" 
           
maxStringContentLength="8192" 
           
maxArrayLength="16384" 
           
maxBytesPerRead="4096" 
           
maxNameTableCharCount="16384"/> 


这篇关于仅当服务返回FaultException&lt; T&gt;时,QuotaExceededException.其中T是一个相当大的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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