I have a WCF service operation that takes a byte array as part of a data contract. The service is distributed only domestically (and not on the Internet), and I want to increase quotas to allow an array of 10 MB in size.
The service is hosted on IIS7. When I try to send an array of bytes by default, I get the following exception message:
Error deserializing an object of type MyService.ServiceContracts.Data. The maximum length length of the array (16384) was exceeded when reading XML data. This quota can be increased by changing the MaxArrayLength property to the XmlDictionaryReaderQuotas object used to create the XML reader. Line 1, position 22991.
Here's the configuration:
<system.serviceModel> <netTcpBinding> <binding name="largeBinaryBinding" maxReceivedMessageSize="10001000" maxBufferPoolSize="80008000" maxBufferSize="10001000" receiveTimeout="00:01:00" openTimeout="00:01:00" closeTimeout="00:01:00" sendTimeout="00:01:00"> <readerQuotas maxArrayLength="10000000" /> </binding> </netTcpBinding> <services> <service name="MyService"> <endpoint binding="netTcpBinding" bindingConfiguration="largeBinaryBinding" bindingNamespace="http://my.services.co.uk/MyService" contract="Services.MyService.ServiceContracts.IMyService" /> </service> </services> </system.serviceModel>
Thus, my configuration allows you to receive larger messages, but IIS seems to ignore this - how can I stop this and allow larger messages?
source share