Search code examples
wcfwcf-data-serviceswcf-binding

Sending records table with photos exceeds quota


Code Settings

<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding>
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
<basicHttpBinding>
<binding maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="SilverlightApplication2.Web.EpriscriptionSrv">
<endpoint address="" binding="customBinding"
contract="SilverlightApplication2.Web.EpriscriptionSrv" />
<endpoint address="mex" binding="customBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>

Displayed error help enter image description here

Visit but did not answer

Wcf-The maximum message size quota for incoming messages (65536) has been exceeded?

enter image description here


Solution

  • Your service host config file is not the same as your client application's config.

    In fact, increasing maxReceivedMessageSize does not really have any effect when placed in the server-side web.config. When your service is added as a reference in another application. It will generate a client configuration much like the one you see in your last screenshot. This, however, will often default to a message size that is typical of a smaller-scale web service.

    In order to receive larger messages, you must increase the maxReceivedMessageSize attribute on your client-side configuration.

    Since you are currently using the WCF Test Client I will give a couple screenshots for how to do it there:

    1. When you start up the WCF Test Client. Navigate down to "Config File", right click, and select "Edit with SvcConfigEditor".
    2. In the new configuration editor window: expand the "Bindings" menu and select your binding. Then edit the MaxReceivedMessageSize attribute. Service Config Utility screen
    3. Click File -> Save, and close the editor.
    4. On the WCF Test Client. There should now be a new pop-up stating that the configuration was modified by an outside editor, and prompting you to reload. Click "Yes" to do so. WCF Test Client Reload Menu
    5. The "Config File" menu in the WCF Test Client should now reflect the new changes. Now proceed with your test call in the WCF Test Client as normal.

    When deploying this application. You will have to ensure that the client's configuration files have appropriate values in the maxReceivedMessageSize attribute in order to consume your service, but this should get the test client running for now.