1
votes

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.

3
How large are the files to be transferred? It may help to use streaming with the http binding.Chris O
Forgot to say - it's fail while 1mb file sending.Brian J. Hakim
I found this very interesting comment about that propblem: stackoverflow.com/a/4808527/383187. But in my tracking there is no 'No Endpoint found' messagesBrian J. Hakim

3 Answers

2
votes

Looks like the main problem is that your endpoint does not reference a binding configuration. You are therefore using the default 65536.

There are a few other things to check:

  • You have 2 endpoints for the same contract are you using the one where maxReceivedMessageSize is set?
  • Does the configuration on the client match that on the server?
  • You may also need to set "maxBufferPoolSize" and "maxBufferSize"
0
votes

Answer is quite simple:

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

I did not see that there is bindingName instead of bindingConfiguration

0
votes

I was also facing this problem later, but then i solved it by adding the dataContractSerializer maxItemsInObjectGraph="2147483646" in the behaviour of the service