0

调用我的服务时出现以下错误;

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.

服务的配置是;

   <bindings>
      <basicHttpBinding>
        <binding name="basic" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" >
          <readerQuotas maxDepth="32" maxStringContentLength="67108864" maxArrayLength="10240000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="Company.Product.Service.FileManager.IFileManager">
        <endpoint binding="basicHttpBinding" bindingConfiguration="basic" name="FileManager" bindingNamespace="Company.Product.FileManager.FileManagerService" contract="Company.Product.Service.FileManager.IFileManager" />
        <host>
          <baseAddresses>
            <add baseAddress="http://filemanager.dev.v7.services.Company.net" />
          </baseAddresses>
        </host>
      </service>
    </services>

正如你所看到的,我已经相应地调整了设置,所以不知道为什么我仍然收到这个错误。

客户端配置;

 <bindings>
      <basicHttpBinding>
        <binding name="basic" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="67108864" maxArrayLength="10240000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>

      <endpoint address="http://filemanager.dev.v7.services.Company.net/service.svc" binding="basicHttpBinding" bindingConfiguration="basic" contract="Company.Product.Service.FileManager.IFileManager" name="FileManager"/>
    </client>

更新

将服务配置更改为此(删除绑定名称),这现在可以工作,但为什么它不能与命名配置一起工作;

<bindings>
      <basicHttpBinding>
        <binding name="" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" >
          <readerQuotas maxDepth="32" maxStringContentLength="67108864" maxArrayLength="10240000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding>
    </bindings>
4

1 回答 1

1

您还必须更改客户端的 app.config。

编辑:

如果您将 name 属性留空,它将应用于未命名类型的每个绑定。如果您在配置中有一个命名绑定,则只有在该名称明确引用它时才会拾取它。

于 2012-10-26T12:56:40.927 回答