XML データの読み取り中に最大配列長クォータ (16384) を超えました。 がエラーで回避できません。 誰か教えて下さい。 お願いしします。
-
2011年7月31日 8:28
maxArrayLength="64096" を変更すれば、問題がないと思うのです正しく動きません。
何が原因かわかりませんので教えて下さい。お願いしします。
- APP.COFIGの内容
<system.serviceModel
<bindings>
<basicHttpBinding>
<binding name="NewBinding0" maxBufferSize="64096" maxReceivedMessageSize="64096" transferMode ="StreamedRequest" receiveTimeout="05:00:00" sendTimeout ="05:00:00" openTimeout ="05:00:00" closeTimeout ="05:00:00" maxBufferPoolSize ="64096">
<readerQuotas maxDepth="64" maxStringContentLength="64096" maxArrayLength="64096" maxBytesPerRead="64096" maxNameTableCharCount="64096" />
</binding >
</basicHttpBinding>
</bindings><behaviors>
<serviceBehaviors>
<behavior>
<!-- メタデータ情報の開示を避けるには、展開する前に、下の値を false に設定し、上のメタデータのエンドポイントを削除します -->
<serviceMetadata httpGetEnabled="true"/>
<!-- デバッグ目的で障害発生時の例外の詳細を受け取るには、下の値を true に設定します。例外情報の開示を避けるには、展開する前に false に設定します -->
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="64096"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>または、binding をNEWしても同様です。
MemoryStream inUpdStream = new MemoryStream();
for (Int64 cnt = 0; cnt < 100; cnt++)
{for (byte a = 0; a < 255; a++)
{
inUpdStream.WriteByte(a);
}
}BasicHttpBinding binding = new BasicHttpBinding();
XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas();readerQuotas.MaxArrayLength = 100 * 1024;
readerQuotas.MaxBytesPerRead = 100 * 1024;
readerQuotas.MaxNameTableCharCount = 100 * 1024;
binding.ReaderQuotas = readerQuotas;
EndpointAddress endpoint = new EndpointAddress(@"http://localhost:59395/Service1.svc");ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client(binding, endpoint);
proxy.Ots_test(inUpdStream.ToArray());
proxy.Close();参考
WEB.CONFIGです。
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength = "64096" />
</system.web>
<system.serviceModel><bindings>
<basicHttpBinding>
<binding name="NewBinding0" maxBufferSize="64096" maxReceivedMessageSize="64096" transferMode ="StreamedRequest" receiveTimeout="05:00:00" sendTimeout ="05:00:00" openTimeout ="05:00:00" closeTimeout ="05:00:00" maxBufferPoolSize ="64096">
<readerQuotas maxDepth="64" maxStringContentLength="64096" maxArrayLength="64096" maxBytesPerRead="64096" maxNameTableCharCount="64096" />
</binding >
</basicHttpBinding>
</bindings><behaviors>
<serviceBehaviors>
<behavior>
<!-- メタデータ情報の開示を避けるには、展開する前に、下の値を false に設定し、上のメタデータのエンドポイントを削除します -->
<serviceMetadata httpGetEnabled="true"/>
<!-- デバッグ目的で障害発生時の例外の詳細を受け取るには、下の値を true に設定します。例外情報の開示を避けるには、展開する前に false に設定します -->
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="64096"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel><system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

