3

WCF で大きなデータを転送しようとすると、次のエラーが発生します。

メッセージのデシリアライズ中にフォーマッタが例外をスローしました: パラメータ http://tempuri.org/:requeteのデシリアライズ中にエラーが発生しました。InnerException メッセージは、「System.String 型のオブジェクトのデシリアライズ中にエラーが発生しました。XML データの読み取り中に、文字列コンテンツの最大長クォータ (8192) を超えました。このクォータは、XML リーダーの作成時に使用される XmlDictionaryReaderQuotas オブジェクトの MaxStringContentLength プロパティを変更することで増やすことができます。行 1、位置 8843.'。詳細については、InnerException を参照してください。

これは私のapp.configファイルです:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="NewBinding0" maxBufferSize="52428800" maxBufferPoolSize="52428800">
          <readerQuotas maxStringContentLength="52428800" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="TSO_WCF.Service1">
        <host>
           <baseAddresses>
               <add baseAddress="http://localhost:8732/Design_Time_Addresses/TSO_WCF/Service1/" />
           </baseAddresses>
        </host>
        <!-- Service Endpoints -->
        <!-- Unless fully qualified, address is relative to base address supplied above -->
        <endpoint address="" binding="wsHttpBinding" contract="TSO_WCF.IService1" >
           <identity>
              <dns value="localhost"/>
           </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
       <serviceBehaviors>
          <behavior>
             <serviceMetadata httpGetEnabled="True"/>
             <serviceDebug includeExceptionDetailInFaults="False" />
          </behavior>
       </serviceBehaviors>
    </behaviors>
</system.serviceModel>
<appSettings>
   <add key="Mapping" value="D:\workspace\oddo.app.ldw.tsomanagertool\ProjetTSO\MappingsXML"/>
</appSettings>
</configuration>
4

2 に答える 2

3

サーバーとクライアントのバインディングでMaxStringContentLengthを増やす必要があります。現在、デフォルト値の8192を使用しています。

于 2012-12-04T16:41:38.740 に答える
0

おそらく、バインディングを変更したり、ストリーミングを使用したりできます。このページを参照してください:http://msdn.microsoft.com/en-us/library/ms733742.aspx

于 2012-12-04T16:41:18.053 に答える