WCF MaxReceivedMessageSize 无法正常工作(未被读取)

WCF MaxReceivedMessageSize not working correctly (not being read)

我有一个 WCF 服务,我试图在其中提取某个 XML 文件,并将该文件发送给客户端,但我不断收到此错误:

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.

我已经更改了 app.config 中的 maxReceivedMessageSize

App.config

端点配置

<services>
  <service name="MobileReportService.Service" behaviorConfiguration="ServiceBehavior">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8733/Design_Time_Addresses/MobileReportService/Service/" />
      </baseAddresses>
    </host>
    <endpoint name="ServiceEndpoint"
            binding="basicHttpBinding"
            contract="MobileReportService.IService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

绑定配置

<bindings>
  <basicHttpBinding>
    <binding maxBufferPoolSize="5242880" maxBufferSize="5242880"
      maxReceivedMessageSize="5242880" />
  </basicHttpBinding>
</bindings>

不太明白为什么maxReceivedMessageSize无法读取?

编辑

我正在通过 运行 服务时出现的弹出窗口测试服务,方法是按 "Invoke"

您需要删除绑定名称。除非您要定义多个 basicHttpBinding 配置,否则无需定义绑定名称。如果删除名称,定义的设置将应用到使用绑定类型的所有端点。

<bindings>
  <basicHttpBinding>
    <binding maxReceivedMessageSize="(big number)" />
  </basicHttpBinding>
</bindings>