XML 리더를 생성 할 때 사용되는 xmlDictionaryReaderQuotas 객체에서 MaxArrayLength 속성 변경
-
10-07-2019 - |
문제
바이트 배열을 C# 서비스로 보내거나 수신하는 동안 다음과 같은 예외를 얻고 있습니다.
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
내가 이해할 수있는 것에 대해 xmldictionaryReader는 웹 서비스에 의해 자동으로 생성됩니다.
그렇다면 "maxarraylength"속성을 어떻게 변경할 수 있습니까?
이것은 구현 코드입니다.
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;
}
}
파일 <16KB가 업로드됩니다.
파일> 16KB는 그렇지 않습니다.
파일> 10MB는 문제없이 다운로드됩니다.
그 속성은 어디에 구성되어 있습니까?
다른 팁
을 추가하다 <readerQuotas>
내부의 요소 <binding>
요소와 추가 MaxArrayLength
재산
<bindings>
<wsHttpBinding>
<binding name ="Your WSHttpBinding Name" sendTimeout="00:05:00" maxReceivedMessageSize="2147483647">
<security mode="None"></security>
<readerQuotas maxStringContentLength="134217728" maxArrayLength="2147483647" />
<reliableSession enabled="true"/>
</binding>
</wsHttpBinding>
</bindings>
제휴하지 않습니다 StackOverflow