WCF SOAP服务给出MaxRecievedByte错误

本文关键字:MaxRecievedByte 错误 SOAP 服务 WCF | 更新日期: 2023-09-27 18:01:27

我有一个应用程序最近在使用第三方web服务时抛出了很多错误。具体来说,我得到以下错误:

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

我已经检查了我的web中的绑定。配置,它们相当大。肯定大于65536(16位无符号短。)

<binding name="InteractiveOrderHandlerBinding" 
         closeTimeout="00:01:00"
        openTimeout="00:01:00" 
        receiveTimeout="00:10:00" 
        sendTimeout="00:01:00"
        allowCookies="false" 
        bypassProxyOnLocal="false" 
        hostNameComparisonMode="StrongWildcard"
        maxBufferSize="327680" 
        maxBufferPoolSize="524288" 
        maxReceivedMessageSize="327680"
        messageEncoding="Text" 
        textEncoding="utf-8" 
        transferMode="Buffered"
        useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" 
                    maxStringContentLength="81920000" maxArrayLength="16384"
                    maxBytesPerRead="40960000" maxNameTableCharCount="16384" />
      <security mode="Transport">
        <transport clientCredentialType="None" proxyCredentialType="None"
            realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>

这在过去的配置中一直工作得很好,我们没有做任何涉及此代码或此配置的代码更改。我认为这可能是一个错误从服务器反射回来,也许他们是从我的代码接收到太多的数据,而不是其他方式?但我不想求助于他们,直到我做了我的尽职调查,并确保没有任何东西在我这边。

所讨论的应用程序是ASP。. NET应用程序在Windows 2012上运行。IIS7。

这是系统。从我的配置。坦白说,我的配置有一个庞大的系统。ServiceModel,它实际上在多个文件中。以下是与此服务调用相关的元素。

<system.serviceModel>
    <client>
       <endpoint address="https://webxml.choicepoint.com/multistate"
                 binding="basicHttpBinding" 
                 bindingConfiguration="InteractiveOrderHandlerBinding"
                 contract="ChoicePointWS.InteractiveOrderHandler" 
                 name="InteractiveOrderHandlerPort" />
    </clent>
   <bindings>
  <basicHttpBinding>
    <binding name="InteractiveOrderHandlerBinding" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="327680" maxBufferPoolSize="524288" maxReceivedMessageSize="327680"
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="81920000" maxArrayLength="16384"
                 maxBytesPerRead="40960000" maxNameTableCharCount="16384" />
        <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
    </binding>
    <binding name="basicHttpBinding" maxReceivedMessageSize="102400000"
        maxBufferSize="102400000" sendTimeout="00:30:00" receiveTimeout="infinite">
        <readerQuotas maxArrayLength="16384000" maxBytesPerRead="40960000"
        maxDepth="32" maxNameTableCharCount="16384000"
        maxStringContentLength="81920000" />
    </binding>
  </basicHttpBinding>
  <wsHttpBinding>
      <binding name="wsHttpBinding" maxReceivedMessageSize="102400000"
               sendTimeout="00:30:00" receiveTimeout="infinite">
          <readerQuotas maxArrayLength="16384000" maxBytesPerRead="40960000"
                        maxDepth="32" maxNameTableCharCount="16384000"
                        maxStringContentLength="81920000" />
      </binding>
  </wsHttpBinding>    
</bindings>  
</system.serviceModel>

TIA。

WCF SOAP服务给出MaxRecievedByte错误

"MaxRecievedByte error"正确吗?似乎错误更像是"最大消息大小..(65536)…超过" .

我怀疑这是你的配置。不是第三方。与您发布的(详细)错误一致,我看到后来的错误是由于maxReceivedMessageSize值对于返回的消息太小而发生的。这个错误可能看起来是零星的,但根据我的经验,它实际上可能只是由于有时收到出乎意料的大响应。考虑使用最大值2147283954(我认为)进行测试。

我建议非常小心地跟踪您的设置,并确保您已经更新了正确的端点,basicHttpBindingmaxReceivedMessageSize

  • 文档。Microsoft:运输配额
  • 文档。微软:大数据和流媒体