I'm getting the following exception while sending ( or receiving ) a byte array to a C# service.
There was an error deserializing the object of type System.Byte[].
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.
Line 6, position 34838.'.
Please see InnerException for more details
For what I can understand the XmlDictionaryreader is created automatically by the webservice.
So, how can I change the "MaxArrayLength" property?
This is the implementation code:
public string addFile(string sharePointServer, string documentLibrary,
byte[] content, string fileName)
{
try
{
SPWeb spWeb = new SPSite(sharePointServer).OpenWeb();
SPFolder spFolder = spWeb.GetFolder(documentLibrary);
SPFileCollection spFileCollection = spFolder.Files;
SPFile spFile = spFileCollection.Add(fileName, content, true);
return spFile.TimeCreated.ToLongDateString() + "::" + spFile.Title;
}
catch (Exception ex)
{
throw ex;
}
}
Files < 16kb are uploaded.
Files > 16kb are not.
Files > 10mb are downloaded without problem.
Where is that property configured?