ServiceStack: The maximum array length quota (16384) has been exceeded while reading XML data

StackOverflow https://stackoverflow.com//questions/22042095

  •  21-12-2019
  •  | 
  •  

Question

I've set up ServiceStack to provide web services for my MVC 4 website. I will only be using Soap1.2 with the web services and so far it's been working well.

Except when I'm trying to send a byte array that's too large after which I get the following error:

The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader.

On the client side I've set the readerQuotas for the binding and it seems to pick it up correctly so the problem looks to be on the server side. Normally one would add the binding settings for the web service in the web.config but I'm unsure how to do this for ServiceStack.

That is if it's ServiceStack that's causing the problem.

How would I go about sending a large amount of data to a Soap1.2 web service created with ServiceStack? (Unfortunately by making use of a byte array)

Was it helpful?

Solution

As noted by @cvbarros the value can be specified in the application initialisation code:

DataContractSerializer.Instance = new DataContractSerializer(new XmlDictionaryReaderQuotas
{  
    MaxStringContentLength = /* new value */; 
};
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top