Wcf - 已超出传入消息 (65536) 的最大消息大小配额?

     2023-02-22     279

关键词:

【中文标题】Wcf - 已超出传入消息 (65536) 的最大消息大小配额?【英文标题】:Wcf-The maximum message size quota for incoming messages (65536) has been exceeded? 【发布时间】:2013-11-03 01:10:48 【问题描述】:

已超出传入邮件的最大邮件大小配额 (65536)。要增加配额,请在适当的绑定元素上使用 MaxReceivedMessageSize 属性。

<system.serviceModel>

<services>
  <service name="FileService.Service1" behaviorConfiguration="FileService.Service1Behavior">
    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Design_Time_Addresses/FileService/Service1/" />
      </baseAddresses>
    </host>
    <!-- Service Endpoints -->
    <!-- Unless fully qualified, address is relative to base address supplied above -->
    <endpoint address ="" binding="wsHttpBinding" contract="FileService.IService1">
      <!-- 
          Upon deployment, the following identity element should be removed or replaced to reflect the 
          identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
          automatically.
      -->
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <!-- Metadata Endpoints -->
    <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
    <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="FileService.Service1Behavior">
      <!-- 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" />
    </behavior>
  </serviceBehaviors>
  </behaviors>
  </system.serviceModel>

【问题讨论】:

您应该设置 maxReceivedMessageSize="2147483647" 以增加邮件大小 我不确定在哪里设置,因为我没有添加任何绑定,app.config 中的所有内容都是默认设置 WCF - How to Increase Message Size Quota 的副本。 @Tarantino 默认为 65536。打开你的 app.config 并更改它。您应该在服务器端和客户端更改此值。 @CodeCaster 即使给出同样的错误 【参考方案1】:

您应该设置 maxReceivedMessageSize="2147483647" 以增加消息大小。尝试将配置更改为:

<binding maxBufferSize="2147483647" 
         maxBufferPoolSize="2147483647" 
         maxReceivedMessageSize="2147483647">
    <readerQuotas maxDepth="2147483647" 
                  maxStringContentLength="2147483647" 
                  maxArrayLength="2147483647" 
                  maxBytesPerRead="2147483647"
                  maxNameTableCharCount="2147483647" />
</binding>

但是将消息值增加到最大值是一种不好的做法。这可能会导致您遇到 DOS 泄漏的严重问题。

更新:

<system.serviceModel>
  <bindings>
   <wsHttpBinding>
    <binding name="wsBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647"  >
      <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" />
    </binding>
   </wsHttpBinding> 
  </bindings>
  <services>
  <service name="FileService.Service1" behaviorConfiguration="FileService.Service1Behavior">
  <host>
    <baseAddresses>
      <add baseAddress = "http://localhost:8732/Design_Time_Addresses/FileService/Service1/" />
    </baseAddresses>
  </host>
   <endpoint address ="" binding="wsHttpBinding" bindingConfiguration="wsBinding" contract="FileService.IService1">   
   <identity>
    <dns value="localhost"/>
   </identity>
 </endpoint>

 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
 </service>
 </services>
 <behaviors>
   <serviceBehaviors>
     <behavior name="FileService.Service1Behavior">    
       <serviceMetadata httpGetEnabled="True"/>    
       <serviceDebug includeExceptionDetailInFaults="False" />
     </behavior>
   </serviceBehaviors>
 </behaviors>
</system.serviceModel>

【讨论】:

我应该在 app.config 中哪里提到这一点,我这样做了,但它给出了错误 @Tarantino 显示你的配置。这应该在您的绑定配置中设置。 我没有在 app.config 中设置任何绑定,我应该在该绑定下设置 正如您所说的“这可能会导致您遇到 DOS 泄漏的严重问题”,有没有更好的方法? 快速记住:2147483647 是第 8 个梅森素数... :)

WCF,已超出传入邮件的最大邮件大小配额 (65536)

】WCF,已超出传入邮件的最大邮件大小配额(65536)【英文标题】:WCF,Themaximummessagesizequotaforincomingmessages(65536)hasbeenexceeded【发布时间】:2015-09-1520:33:30【问题描述】:这个问题可能已经有了答案,但没有一个对我有用。我对WCF很陌... 查看详情

超过 (65536) 时如何增加 WCF 服务的传入消息的最大消息大小配额

...ded【发布时间】:2014-06-2408:10:51【问题描述】:问题:已超出传入邮件的最大邮件大小配额(65536)。要增加配额,请在适当的绑定元素上使用MaxRece 查看详情

已超出传入邮件的最大邮件大小配额 (65536)

】已超出传入邮件的最大邮件大小配额(65536)【英文标题】:Themaximummessagesizequotaforincomingmessages(65536)hasbeenexceeded【发布时间】:2011-11-0603:16:58【问题描述】:我对WCF服务有以下配置。即使我增加了maxReceivedMessageSize,服务仍然会抛... 查看详情

调用wcf时,调用已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定。

解决方案:其实只要在客户端配置文件中加上如下紫色粗体属性(maxReceivedMessageSize):<?xmlversion="1.0"encoding="utf-8"?><configuration><system.serviceModel><bindings><basicHttpBinding><bindingname=" 查看详情

已超出传入邮件的最大邮件大小配额 (65536)

】已超出传入邮件的最大邮件大小配额(65536)【英文标题】:Themaximummessagesizequotaforincomingmessages(65536)hasbeenexceeded【发布时间】:2011-07-2412:01:03【问题描述】:我在为几个表创建范围时遇到了这个异常,所有这些表的设计都很庞大&... 查看详情

webservice之已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的maxreceivedmessagesize属性。

  在使用WCF中,遇到如下问题:   已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的MaxReceivedMessageSize属性。  问题说明:  客户端调用WCF返回数据量大时,局域网没有问题(客户... 查看详情

WCF MaxReceivedMessageSize:超出最大邮件大小配额

】WCFMaxReceivedMessageSize:超出最大邮件大小配额【英文标题】:WCFMaxReceivedMessageSize:maximummessagesizequotaexceeded【发布时间】:2010-12-0702:43:18【问题描述】:我收到此错误:传入邮件的最大邮件大小配额(65536)已达到超过。要增加配额... 查看详情

解决异常:已超过传入消息(65536)的最大消息配额

异常描述:    解决方案:    在web.config中修改配置详细步骤:      查看详情

WCF 服务已超出最大数组长度配额 (16384)

】WCF服务已超出最大数组长度配额(16384)【英文标题】:WCFserviceThemaximumarraylengthquota(16384)hasbeenexceeded【发布时间】:2011-03-0507:53:15【问题描述】:我有一个wsf服务和一个客户端应用程序。在尝试与客户端和服务进行通信时,我收... 查看详情

WCF 中的 MaxReceivedMessageSize 错误

...面临的一些新问题。所以请给我一个有效的解决方案。已超出传入邮件的最大邮件大小配额(65536)。要增加配额,请在适当的绑 查看详情

WCF 最大消息大小配额

...不是IIS中)并且收到以下错误:最大邮件大小配额已超过传入消息为远程通道。见服务器日志以获取更多详细信息。我尝试将MaxReceivedMessageSize和ReaderQuotas增加到它们的最大值,但没有任何运气。我还打开了 查看详情

WCF 服务 400 错误请求

...务器时,我得到了:Badrequest(400)。该异常的服务跟踪:已超出传入邮件的最大邮件大小配额(65536)。要增加配额,请在适当的绑定元素上使用MaxRe 查看详情

WCF:如何设置 MaxReceivedMessageSize 配额

...:我有一个WCF服务。运行客户端应用程序时收到以下消息传入邮件的最大邮件大小配额(65536)已达到超过。要增加配额,请使用MaxReceivedMessageSize相应绑定元素上的属性。我还在客户端和服务器项目的相关 查看详情

已超出最大可命名字符数配额 (16384)

】已超出最大可命名字符数配额(16384)【英文标题】:Themaximumnametablecharactercountquota(16384)hasbeenexceeded【发布时间】:2013-08-1616:17:34【问题描述】:我刚刚增加了我的ServiceContract中的方法数量。当我在VisualStudio中更新服务参考时,... 查看详情

WCF 错误“对象图中可以序列化或反序列化的最大项目数为 '65536'”

】WCF错误“对象图中可以序列化或反序列化的最大项目数为\\\'65536\\\'”【英文标题】:WCFError"Maximumnumberofitemsthatcanbeserializedordeserializedinanobjectgraphis\'65536\'"WCF错误“对象图中可以序列化或反序列化的最大项目数为\'65536\'... 查看详情

WCF 错误“对象图中可以序列化或反序列化的最大项目数为 '65536'”

】WCF错误“对象图中可以序列化或反序列化的最大项目数为\\\'65536\\\'”【英文标题】:WCFError"Maximumnumberofitemsthatcanbeserializedordeserializedinanobjectgraphis\'65536\'"WCF错误“对象图中可以序列化或反序列化的最大项目数为\'65536\'... 查看详情

webservice或wcf调用时读取xml数据时,超出最大字符串内容长度配额(8192)解决方法

1.调用服务时服务  当我们使用WebService或WCF服务时,常把读取的数据转化为string类型(xml格式),当数据量达到一定数量时,会出现以下异常:    错误:格式化程序尝试对消息反序列化时引发异常:尝试对... 查看详情

OData 异常已超出 Top 查询的“0”限制

】OData异常已超出Top查询的“0”限制【英文标题】:ODataExceptionThelimitof\'0\'forTopqueryhasbeenexceeded【发布时间】:2017-01-3001:27:43【问题描述】:我正在使用版本4的ODataWebAPI,当我尝试使用$top参数查询ODataWebApi时,它返回以下异常消... 查看详情