有关MaxReceivedMessageSize的WCF错误

时间:2016-02-16 20:23:29

标签: c# wcf

我一直在研究这个错误一段时间,我觉得这个问题一直都会被问到......但我似乎无法找到问题。

我收到了正常的MaxReceivedMessageSize错误:

The maximum message size quota for incoming messages (65536) has been exceeded. 

我的服务配置中是否遗漏了某些内容?

<system.serviceModel>
<services>
  <service name="LifeEApplication.Services.RateService.RateServiceHost" behaviorConfiguration="RateService.RateServiceHostBehavior">
    <endpoint address="" binding="basicHttpBinding" contract="LifeEApplication.Services.Contracts.RateServiceContract.IRateService"/>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="RateService.RateServiceHostBehavior">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="200" maxConcurrentInstances="200"/>
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="BasicBinding" 
             maxBufferPoolSize="2147483647" 
             maxBufferSize="2147483647" 
             maxReceivedMessageSize="2147483647" 
             receiveTimeout="00:02:00" 
             sendTimeout="00:02:00">

      <readerQuotas maxDepth="2147483647" 
                    maxStringContentLength="2147483647" 
                    maxArrayLength="2147483647" 
                    maxBytesPerRead="2147483647" 
                    maxNameTableCharCount="2147483647"/>

      <security mode="Transport">
        <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
        <message clientCredentialType="Certificate" algorithmSuite="Default"/>
      </security>
    </binding>
    <binding name="LocalBinding" 
             maxBufferPoolSize="2147483647" 
             maxBufferSize="2147483647" 
             maxReceivedMessageSize="2147483647" 
             receiveTimeout="00:02:00" 
             sendTimeout="00:02:00">

      <readerQuotas maxDepth="2147483647" 
                    maxStringContentLength="2147483647" 
                    maxArrayLength="2147483647" 
                    maxBytesPerRead="2147483647" 
                    maxNameTableCharCount="2147483647"/>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="https://integrationmdl.grangeinsurance.com/lifequote/LoggingServiceHost/DotNetLoggingServiceHost.svc" 
            binding="basicHttpBinding" 
            bindingConfiguration="BasicBinding" 
            name="BasicBinding" 
            contract="LifeEApplication.Services.Contracts.LoggingServiceContract.IDotNetLoggingService"/>

  <endpoint address="https://integrationmdl.grangeinsurance.com/lifequote/OracleTrimarkServiceHost/OracleTrimarkServiceHost.svc" 
            binding="basicHttpBinding" 
            bindingConfiguration="BasicBinding" 
            name="BasicBinding" 
            contract="LifeEApplication.Services.Contracts.OracleServiceContract.IOracleService"/>
</client>

我的功能可以正常处理少量数据,因此我知道这是MaxReceivedMessageSize大小的问题。我尝试的一切都会导致同样的问题。

注意事项:当我使用WCF Test Client调试服务时,显示的Config文件没有我在其配置中指定的最大大小。

2 个答案:

答案 0 :(得分:1)

听起来客户端配置需要增加邮件大小。右键单击配置文件,选择&#34;编辑WCF配置&#34;,然后更改MaxReceivedMessageSize值。

答案 1 :(得分:0)

我同意eschneider。您需要更改客户端(RateService项目)MAIN Web.config文件下的设置。右键单击它并选择“编辑WCF配置”。在“配置”面板下的弹出窗口中,选择“绑定”&gt; YourDefinedBinding (例如wsHttpBinding)。然后将MaxReceivedMessageSize更改为2147483647.我希望这可以帮助您。