1

I have a WCF service for which I have specified custom binding/readerQuotas settings. However, the service still fails with the message:

The maximum string content length quota (...) has been exceeded"

I suspect that the readerQuotas settings may not get applied, because the service is instantiated via a custom ServiceHostFactory (to which I don't have access).

Is there a way to inspect the current readerQuotas settings for a service using the OperationContext?

Cristian Lupascu
  • 39,078
  • 16
  • 100
  • 137

1 Answers1

3

Just found a quick an dirty way to do this:

((WSHttpBinding)OperationContext.Current.Host.Description.Endpoints[0].Binding).ReaderQuotas
Cristian Lupascu
  • 39,078
  • 16
  • 100
  • 137
  • The problem with this approach is that if the host supports multiple endpoints, usually when multiple bindings are offered, you're likely getting the wrong binding. – Mr. TA Oct 12 '18 at 14:30