views:

39

answers:

0

Hey there,

I have enabled compression of my WCF service by implementing the sample GZip encoder featured on on MSDN and everything is working great, however now need to transfer my reader quotas across to this binding, as I previously had these customised when I was using wsHttpBinding.

This is my GZip binding as declared in my Web.config of the wcf service:

  <customBinding>
    <binding name="BufferedHttpCompressionBinding" closeTimeout="00:00:15"
      openTimeout="00:00:15" receiveTimeout="00:00:15" sendTimeout="00:00:15">
      <gzipMessageEncoding innerMessageEncoding="textMessageEncoding">
      </gzipMessageEncoding>
      <httpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
        maxBufferSize="2147483647">
        <extendedProtectionPolicy policyEnforcement="Never" />
      </httpTransport>
    </binding>
  </customBinding>

As you can see without the reader quotas, now here are the readerQuotas that I would like to add:

<readerQuotas
              maxDepth="64"
              maxStringContentLength="1048576"
              maxArrayLength="1048576"
              maxBytesPerRead="1048576"
              maxNameTableCharCount="1048576" />   

I have tried inserting this node as a child of the <binding /> element, and also I saw an example online of it between the <gzipMessageEncoding /> element, neither of the two work for me returning an error:

System.Configuration.ConfigurationErrorsException: Unrecognized element 'readerQuotas'.

Any thoughts? Is it possible to use reader quotas with custom bindings? I imagine it would have to be, but might this be a class change, or a simple way to get it going through config? Hopefully some WCF whiz can help :)

Many thanks, Graham.