I have no trouble retrieving a large amount of data, but sending it back to the service displays this error. I've tried adding the element to both the web.config and servicereferences.clientconfig and it's not recognized in either. At one point I got a message about adding readerQuotas to bindingElementExtensions, but I can't find anything useful on how to do this. I found posts saying I had to modify the devenv.exe.config and such, but doing that hosed VS.
Here's the binding section of the web.config:
<bindings>
<customBinding>
<binding name="QaRiM.Web.Service1.customBinding0">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="QaRiM.Web.Service1">
<endpoint address="" binding="customBinding" bindingConfiguration="QaRiM.Web.Service1.customBinding0"
contract="QaRiM.Web.Service1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
and the servicereferences.clientconfig:
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_Service1">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://localhost:36533/Service1.svc" binding="customBinding"
bindingConfiguration="CustomBinding_Service1" contract="ServiceReference1.Service1"
name="CustomBinding_Service1" />
</client>
</system.serviceModel>
</configuration>
Both were generated by VS.
You are simply missing the configuration for the maximum string content length.
Add this to your binding attributes (client and server)
<readerQuotas maxStringContentLength="2147483647" />
Sorry, I didn't realize that this child element is located under the encoding being used when using a custom binding, it appears to bebinaryMessageEncoding
in your example. If not, try the other encodings with the setting.
<bindings>
<customBinding>
<binding name="QaRiM.Web.Service1.customBinding0">
<binaryMessageEncoding>
<readerQuotas maxStringContentLength="2147483647"/>
</binaryMessageEncoding>
</binding>
</customBinding>
</bindings>
if The maximum string content length quota (8192) has been exceeded while reading XML data.” is ignoring your web.config settings EVEN after you set you can also solve the problem in your code by creating an instance of XmlDictionaryReaderQuotas and setting the MaxStringContentLength to 2147483647
then just use the instance of XmlDictionaryReaderQuotas seen here as mycreatedreaderquota
XmlDictionaryReaderQuotas mycreatedreaderquota = new XmlDictionaryReaderQuotas();
mycreatedreaderquota.MaxStringContentLength = 2147483647;
XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(stream, mycreatedreaderquota);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With