1

I've created a service to receive large files. After that I've published it on my local IIS7. After that I've created test client with service reference. When I trying to send large file to server I've got: Bad request (400).

Service tracing of that exception: 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.

Server config:

  <system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="2097151" useFullyQualifiedRedirectUrl="true" executionTimeout="14400"/>
<customErrors mode="Off" /></system.web>

Binding

      <wsHttpBinding>
    <binding name="wsBufferedHttpsBinding" messageEncoding="Mtom" 
             maxReceivedMessageSize="11534336" maxBufferPoolSize="524288"
             sendTimeout="00:05:00" receiveTimeout="00:05:00" openTimeout="00:05:00" closeTimeout="00:05:00" >
      <readerQuotas maxDepth="64" maxStringContentLength="11534336" maxArrayLength="11534336"
          maxBytesPerRead="11534336" maxNameTableCharCount="16384" />
    </binding>
  </wsHttpBinding>

Service

      <service name="MyService">
    <endpoint address=""
              binding="wsHttpBinding"
              bindingName="wsBufferedHttpsBinding"
              contract="IServiceContract">
    </endpoint>
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
    <endpoint address="soap12IssuedToken" binding="customBinding"
      bindingConfiguration="soap12IssuedToken" name="soap12IssuedToken"
      bindingNamespace="http://url"
      contract="IServiceContract" />
  </service>

What the hell wrong with this service? I set this message size everywhere.

4

3 に答える 3

2

主な問題は、エンドポイントがバインディング構成を参照していないことのようです。したがって、デフォルトの65536を使用しています。

チェックする他のいくつかのことがあります:

  • 同じコントラクトに2つのエンドポイントがあり、maxReceivedMessageSizeが設定されているエンドポイントを使用していますか?
  • クライアントの構成はサーバーの構成と一致していますか?
  • 「maxBufferPoolSize」と「maxBufferSize」を設定する必要がある場合もあります
于 2012-04-15T12:57:25.217 に答える
0

答えは非常に簡単です。

 <endpoint address=""
          binding="wsHttpBinding"
          bindingName="wsBufferedHttpsBinding"
          contract="IServiceContract">

bindingConfigurationの代わりにbindingNameがあることはわかりませんでした

于 2012-04-15T15:10:36.177 に答える
0

私も後でこの問題に直面してい ましたが、サービスの動作にdataContractSerializer maxItemsInObjectGraph="2147483646"を追加することで解決しました

于 2012-05-15T03:31:50.677 に答える