Search code examples
wcfoperationcontext

Inspect ReaderQuotas settings via OperationContext


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?


Solution

  • Just found a quick an dirty way to do this:

    ((WSHttpBinding)OperationContext.Current.Host.Description.Endpoints[0].Binding).ReaderQuotas