Note that there are some explanatory texts on larger screens.

plurals
  1. POModify endpoint ReaderQuotas programmatically
    text
    copied!<p>I have a dynamic client to a service. How can i change the ReaderQuotas property of it's endpoint binding?</p> <p>I tried like this but it doesn't work ...</p> <pre><code> DynamicProxyFactory factory = new DynamicProxyFactory(m_serviceWsdlUri); foreach (ServiceEndpoint endpoint in factory.Endpoints) { Binding binding = endpoint.Binding; binding.GetProperty&lt;XmlDictionaryReaderQuotas&gt;(new BindingParameterCollection()).MaxArrayLength = 2147483647 binding.GetProperty&lt;XmlDictionaryReaderQuotas&gt;(new BindingParameterCollection()).MaxBytesPerRead =2147483647; binding.GetProperty&lt;XmlDictionaryReaderQuotas&gt;(new BindingParameterCollection()).MaxDepth = 2147483647; binding.GetProperty&lt;XmlDictionaryReaderQuotas&gt;(new BindingParameterCollection()).MaxNameTableCharCount = 2147483647; binding.GetProperty&lt;XmlDictionaryReaderQuotas&gt;(new BindingParameterCollection()).MaxStringContentLength = 2147483647; } </code></pre> <p>Even after doing this the ReaderQuotas values remain the default ones.</p> <p>I also tried like this and still doesn't work:</p> <pre><code> DynamicProxyFactory factory = new DynamicProxyFactory(m_serviceWsdlUri); foreach (ServiceEndpoint endpoint in factory.Endpoints) { System.ServiceModel.Channels.BindingElementCollection bec = endpoint.Binding.CreateBindingElements(); System.ServiceModel.Channels.TransportBindingElement tbe = bec.Find&lt;System.ServiceModel.Channels.TransportBindingElement&gt;(); tbe.MaxReceivedMessageSize = 2147483647; tbe.MaxBufferPoolSize = 2147483647; TextMessageEncodingBindingElement textBE = bec.Find&lt;TextMessageEncodingBindingElement&gt;(); if (textBE != null) { textBE.ReaderQuotas.MaxStringContentLength = 2147483647; textBE.ReaderQuotas.MaxArrayLength = 2147483647; textBE.ReaderQuotas.MaxBytesPerRead = 2147483647; textBE.ReaderQuotas.MaxDepth = 2147483647; textBE.ReaderQuotas.MaxNameTableCharCount = 2147483647; } } </code></pre> <p>I need this so I can send more than 8kb to the service.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload