【问题标题】:The maximum message size quota for incoming messages (65536) has been exceeded- in wcf service已超出传入消息 (65536) 的最大消息大小配额 - 在 wcf 服务中
【发布时间】:2014-10-23 11:31:41
【问题描述】:

我正在编写 wcf 服务以从 sql db 获取数据。它让我返回了大约 2000 行 14 列的数据。我收到错误消息,因为“已超出传入邮件的最大邮件大小配额 (65536)。要增加配额,请在适当的绑定元素上使用 MaxReceivedMessageSize 属性。 我的 web.config 是-

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IService1" 
      hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647"
      maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
      transferMode="Buffered">
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" />
    </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="serviceBehavior" name="GetSqlData1.Service1">
    <endpoint binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
      contract="GetSqlData1.IService1" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="serviceBehavior">
      <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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>
<protocolMapping>
    <add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>    
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

【问题讨论】:

标签: wcf


【解决方案1】:

嗨,请将此行添加到您的 serviceBehaviors 部分:-

<dataContractSerializer maxItemsInObjectGraph="2147483646"/>

请参阅下面的示例。

<serviceBehaviors>
        <behavior name="serviceBehavior">
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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"/>
          <!-- Please add this line -->
          <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
        </behavior>
</serviceBehaviors>

【讨论】:

  • 您好,请您分享客户端配置文件。似乎您的客户端设置是问题的原因。
  • 实际上我正在使用这个 wcf 服务 monikar 来使用宏在 excel 中显示数据。所以我没有客户端配置。我有一个 web.config
猜你喜欢
  • 2013-11-03
  • 2014-02-01
  • 2020-03-18
  • 1970-01-01
  • 1970-01-01
  • 2014-06-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多