2011-08-09 15 views
1

私のWCFアプリケーションでは、他の画像と一緒にbase64String形式の画像を受信します。 私のアプリケーションをテストするために、小さな.aspxページを作成しました。 firstname、lastname、base64string画像:サイズ10Kb)をWCFサービスに送信します。 エラーが発生しました "メッセージをデシリアライズしようとしているときにフォーマッタが例外をスローしました: XMLの読み取り中に最大文字列の内容の長さのクォータ(8192)が超過しましたデータ XMLリーダーを作成するときに使用される XmlDictionaryReaderQuotasオブジェクトのMaxStringContentLengthプロパティを変更することで、このクォータを増やすことができます。WCF通信の問題

私がbase64string(イメージ)なしで文字列を送信すると、私はwcfサービスコードをデバッグできました。 しかし、base64Stringを追加すると、このエラーが発生します。 すべてのバインディング値( "maxReceivedMessageSize")と他の値を最大値に増やしました。 まだこのエラーが発生しています。ここでは、クライアントとサービス用のweb.configがあります。 ありがとうと私は本当にあなたの助けに感謝します。

クライアントのWeb.configは

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpBinding_IRESTService1" closeTimeout="00:01:00" 
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
      useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" 
      maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
      <security mode="None"> 
      <transport clientCredentialType="None" proxyCredentialType="None" 
       realm="" /> 
      <message clientCredentialType="UserName" algorithmSuite="Default" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://localhost:10255/RESTService1.svc" binding="basicHttpBinding" 
     bindingConfiguration="BasicHttpBinding_IRESTService1" contract="ServiceReference1.IRESTService1" 
     name="BasicHttpBinding_IRESTService1" /> 
    </client> 
    </system.serviceModel> 

サービスのweb.config

<system.serviceModel>  
    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicBinding1" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> 
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
      maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
     </binding> 
     </basicHttpBinding>  

    </bindings> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true" /> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 

    <services> 
     <service name="RESTService1"> 
     <endpoint address="" 
      binding="basicHttpBinding" name="MainHttpPoint" contract="RESTService1" bindingConfiguration="BasicBinding1" />  
     </service> 
    </services> 

    <!--<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>--> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true" /> 
    </system.webServer> 

答えて

1

web.configファイルでBindingタグ内に以下の行を追加します。

<binaryMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647"> 
<readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" maxBytesPerRead="2147483647" /> 
</binaryMessageEncoding> 
<httpTransport decompressionEnabled="True" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"/> 

MSDN : binaryMessageEncoding

このヘルプを希望

+0

こんにちはアマニ、あなたの返信をありがとう。しかし、私はタグ内にタグを追加することはできません。どのようなアイデアを追加すればいいですか? – Henry

+0

私の友人は、バインディングタグではなく、バインディングであると言いました。 – saber