2011-06-27 15 views
1

サービスですべての設定が正しく行われましたが、大量のJSONデータをWCF RESTサービスにPUTしようとすると、以下は私のサービスWeb.configです。私はすでに3週間これと苦労しており、答えは見つからなかった。 。。大きなJSONデータをWCF ReSTサービスに送信すると400の不正リクエストが発生する

「型BuildStepResourceの オブジェクトをデシリアライズ中にエラーが発生しました XMLデータを読み出しながら長クォータ (8192)を超えている最大列コンテンツこのクォータ:これは、応答の例外詳細ですXMLリーダーを作成するときに XmlDictionaryReaderQuotasオブジェクト プロパティのMaxStringContentLengthプロパティを変更することによって を増やすことができます。

<system.serviceModel> 
     <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/> 
     <bindings> 
      <webHttpBinding> 
       <binding name="nonSSLBinding" maxReceivedMessageSize="4194304" receiveTimeout="01:00:00" sendTimeout="01:00:00" > 
        <security mode="None"> 
         <transport clientCredentialType="Ntlm"/> 
        </security> 
        <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/> 
       </binding> 
       <binding name="sslBinding" maxReceivedMessageSize="4194304" receiveTimeout="01:00:00" sendTimeout="01:00:00" > 
        <security mode="Transport"> 
         <transport clientCredentialType="Basic"/> 
        </security> 
        <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/> 
       </binding> 
      </webHttpBinding> 
     </bindings> 
     <services> 
      <service behaviorConfiguration="webBehavior" name="serviceEndpoints"> 
       <endpoint address="" binding="webHttpBinding" contract="ISWCRestService" bindingConfiguration="nonSSLBinding" behaviorConfiguration="customBehavior"/> 
       <endpoint address="" binding="webHttpBinding" contract="ISWCRestService" bindingConfiguration="sslBinding" behaviorConfiguration="customBehavior"/> 
       <endpoint address="" binding="webHttpBinding" contract="IXmlEndpoint" bindingConfiguration="nonSSLBinding" behaviorConfiguration="customBehavior"/> 
       <endpoint address="" binding="webHttpBinding" contract="IXmlEndpoint" bindingConfiguration="sslBinding" behaviorConfiguration="customBehavior"/> 
       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
      </service> 
     </services> 
     <behaviors> 
      <serviceBehaviors> 
       <behavior name="webBehavior"> 
        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> 
        <serviceDebug includeExceptionDetailInFaults="true"/> 
        <dataContractSerializer maxItemsInObjectGraph="2147483646" /> 
       </behavior> 
      </serviceBehaviors> 
      <endpointBehaviors> 
       <behavior name="customBehavior"> 
        <webHttp automaticFormatSelectionEnabled="false" helpEnabled="true"/> 
        <dataContractSerializer maxItemsInObjectGraph="2147483646" /> 
       </behavior> 
      </endpointBehaviors> 
     </behaviors> 
    </system.serviceModel> 
+0

あなたは今まで、この問題を解決しましたか?私も同様の問題に直面しています。 – jcreamer898

答えて

1

エラーメッセージは、私はあなたがあなたのweb.configファイル上以外のクライアント側、上MaxStringContentLength性を高める必要があると信じていますを読みながら超過しているクォータを指します。

+0

お返事ありがとうございます。私は最大整数maxReceivedMessageSize = "2147483647"で試しましたが、同じエラーが発生しています。 – Vincent

+0

変更はクライアントで行う必要があります。ブラウザを使わずにクライアントアプリケーションを作成し、試してみてください。 –

+0

ありがとう!クライアントアプリケーションを試してみましたが、同じエラーが発生しています。私はいくつかのトレースを行い、例外はクライアントではなくサーバー上にあることがわかりました。ここに私のクライアントの設定は次のとおりです。 – Vincent

0

私はWCFクライアントで同様の問題がありました。クライアントとサーバーでMaxItemsInObjectGraphを大きく構成する必要があります。私はJSONでこれを行う方法を知らない。

+0

私はサーバーでそれをやったが、まだ動作しませんでした。テストするためにREST Client for FireFoxを使用すると、クライアントでこれをどうやって行うのですか?または、jQueryスクリプトのPUTを呼び出した場合、どうすれば設定できますか?ありがとう! – Vincent

0

クライアント側の設定 -

<binding name="yourBinding" maxReceivedMessageSize="2147483647"> 
      <readerQuotas 
      maxDepth="2147483647" 
      maxStringContentLength="2147483647" 
      maxArrayLength="2147483647" 
      maxBytesPerRead="2147483647" 
      maxNameTableCharCount="2147483647" /> 
</binding> 
+0

<バインディング名= "ClientBinding" sendTimeout = "夜十二時10分00秒" のMaxBufferSize = "2147483647" maxBufferPoolSize = "2147483647" maxReceivedMessageSize = "2147483647"> の – Vincent

+0

それはまだ働いていません。 – Vincent

+0

WSHttpBindingに変更してください – Maxim

0

あなたのweb.configファイルでこれを試してみてください:

<system.web> 
     <compilation debug="true" targetFramework="4.0" /> 
     <httpRuntime maxRequestLength="2147483647"/> 
    </system.web> 
関連する問題