zoukankan      html  css  js  c++  java
  • 访问WebServcie遇到配额不足的时候,请增加配额

    常常遇到的报错:

    1.错误一:

    Error in deserializing body of reply message for operation 'GetArticleInfo'.,StackTrace=
    Server stack trace:
    at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
    at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
    at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
    at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
    at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
    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.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 sunflower.ui.web.KbaseServiceReference.KbaseWebServicesSoap.GetArticleInfo(String itemId, String dBType, String dBName)
    at sunflower.ui.web.Utils.ArticleKbaseUtils.GetArticleViewModel(String filename, String dbType),Source=mscorlib,

    错误二:

     The formatter threw an exception WHILE trying TO deserialize the message: There was an error WHILE trying TO deserialize parameter http://tempuri.org/:GetArticleInfoResponse. The InnerException message was 'There was an error deserializing the object of type sun.ui.web.baseServiceReference.GetArticleInfoResponseBody. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 17144.'.  Please see InnerException FOR more details.,StackTrace=
    SERVER stack trace: 
       AT System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, BOOLEAN isRequest)
       AT System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader reader, PartInfo part, BOOLEAN isRequest)
       AT System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, BOOLEAN isRequest)
       AT System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion VERSION, STRING ACTION, MessageDescription messageDescription, Object[] parameters, BOOLEAN isRequest)
       AT System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, BOOLEAN isRequest)
       AT System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
       AT System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
       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.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 sunflower.ui.web.KbaseServiceReference.KbaseWebServicesSoap.GetArticleInfo(GetArticleInfoRequest request)
       AT sunflower.ui.web.KbaseServiceReference.KbaseWebServicesSoapClient.sunflower.ui.web.KbaseServiceReference.KbaseWebServicesSoap.GetArticleInfo(GetArticleInfoRequest request)
       AT sunflower.ui.web.KbaseServiceReference.KbaseWebServicesSoapClient.GetArticleInfo(STRING itemId, STRING dBType, STRING dBName)
       AT sunflower.ui.web.Utils.ArticleKbaseUtils.GetArticleViewModel(STRING filename, STRING dbType),Source=mscorlib,

    。。。

    我解决此问题采用的办法是修改配置节点为下面的样子,显示声明配额,增大配置值,增加readerQuotas 节点

    web.config中修改为: 

    <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="RECInterfaceSoap" />
            <binding name="baseWebServicesSoap" maxBufferPoolSize="2147483647"  maxReceivedMessageSize="2147483647">
              <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
            </binding>        
          </basicHttpBinding>
          
        </bindings>
        <client>
          <endpoint address="http://127.0.0.1/service/interface.asmx"
            binding="basicHttpBinding" bindingConfiguration="RECInterfaceSoap"
            contract="ecpServiceReference.RECInterfaceSoap" name="RECInterfaceSoap" />
          <endpoint address="http://127.0.0.1:8470/base/baseWebServices.asmx"
            binding="basicHttpBinding" bindingConfiguration="baseWebServicesSoap"
            contract="baseServiceReference.baseWebServicesSoap" name="baseWebServicesSoap" />
        </client>
        <behaviors>
           <serviceBehaviors>
               <behavior name="baseServiceReference.baseWebServicesSoap">
                  <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                  <serviceMetadata httpGetEnabled="true"/>
                  <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                  <serviceDebug includeExceptionDetailInFaults="false"/>
                  <dataContractSerializer maxItemsInObjectGraph="2147483647"/>     
            </behavior>        
          </serviceBehaviors>     
        </behaviors>
      </system.serviceModel> 
  • 相关阅读:
    面试题 41 和为s的两个数字VS 和为S的连续整数序列
    面试题 40 数组中只出现一次的数字
    面试题 39 二叉树的深度
    面试题 38数字在排序数组中出现的次数
    面试题 37 两个链表的第一个公共节点
    面试题36 数组中的逆序对
    面试题 35 第一个出现的字符
    省选模拟65 题解
    省选模拟64 题解
    省选模拟63 题解
  • 原文地址:https://www.cnblogs.com/wangqiideal/p/4936726.html
Copyright © 2011-2022 走看看