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> 
  • 相关阅读:
    上篇用到的matcher函数
    lambdaj学习
    Redis高级应用——2
    Redis入门
    从gitee 下载代码到本地
    CSS中对图片(background)的一些设置心得总结
    nodejs 安装Ionic 和cordova
    Spring MVC内容协商机制详解
    基于Servlet3.0的编程式SpringMVC实例详解
    基于Junit的Spring集成测试方法
  • 原文地址:https://www.cnblogs.com/wangqiideal/p/4936726.html
Copyright © 2011-2022 走看看