2009-07-27 16 views
5

私は現在webHttpバインディングを持つWCFサービスを持っていますが、configのデフォルト設定を上書きしてサービスに入力できる最大サイズを増やそうとしています。WCF webhttpの最大メッセージとバッファサイズを設定する

<system.serviceModel> 
<bindings> 
<webHttpBinding> 
    <binding name="webHttp" > 
    <security mode="Transport"> 
     <transport clientCredentialType = 
      "None" 
      proxyCredentialType="None" 
      realm="string" /> 
    </security> 
    </binding> 

</webHttpBinding> 
</bindings> 
<services> 

    <service name="PrimeStreamInfoServices.Service1" behaviorConfiguration="PrimeStreamInfoServices.Service1Behavior"> 
    <!-- Service Endpoints --> 
    <endpoint address="" binding="webHttpBinding" contract="PrimeStreamInfoServices.IService1"> 
     <!-- 
      Upon deployment, the following identity element should be removed or replaced to reflect the 
      identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
      automatically. 
     --> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="PrimeStreamInfoServices.Service1Behavior"> 
     <!-- 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> 
<diagnostics> 

とメッセージのサイズに関係する様々な他のプロパティを設定するが、いずれも動作していないよう、一方が偶数結合webHttpのM essageサイズを変更することができますか? 提案がありますか?ありがとう!

+0

設定ファイルの関連部分を投稿することはできますか? –

+0

ちょっと編集しました。 – Daniel

答えて

12

あなたの設定によって影響を与える可能性がある設定が多数あります - これ試してみてください。webHttpBindingのあなたの「バージョン」を定義し、より高い値にすべてのこれらのパラメータを設定することにより

<bindings> 
    <webHttpBinding> 
    <binding name="LargeWeb" 
      maxBufferPoolSize="1500000" 
      maxReceivedMessageSize="1500000" 
      maxBufferSize="1500000"> 
     <readerQuotas 
      maxArrayLength="656000" 
      maxBytesPerRead="656000" 
      maxDepth="32" 
      maxNameTableCharCount="656000" 
      maxStringContentLength="656000" 
      /> 
    </binding> 
    </webHttpBinding> 
</bindings> 

は、あなたがする必要があります任意のメッセージサイズ(ほとんど)を通過することができます。

これは、システムが巨大なメッセージであふれてしまう可能性があり、ひどい(古典的なサービス拒否(DoS)攻撃)可能性を秘めています。これが、これらの制限がかなり低く設定されている理由です。意図的に設計されています。

これらの値をより高い値に変更することができます。あなたが行っていることや、セキュリティ上のリスクは何かを意識してください!もちろん、これらの設定を利用するためには、サーバーとクライアント側のコンフィグで設定を結合することを参照する必要があります:

マルク・

はPS

マックスメッセージとバッファサイズを設定する
<client> 
    <endpoint address="http://localhost" 
      binding="webHttpBinding" bindingConfiguration="LargeWeb" 
      contract="IMyService" /> 
</client> 
<services> 
    <service> 
    <endpoint address="http://localhost" 
       binding="webHttpBinding" bindingConfiguration="LargeWeb" 
       contract="IMyService" /> 
    </service> 
</services> 
+0

これは動作しません。まだ64kを超えるものを送ってもらえません。 – Daniel

+0

設定を表示できますか?このバインディング設定を参照しましたか? –

+0

はい、私はこれが私の問題だと気付きました、私はちょうど全体の設定を追加しましたが、bindingCOnfiguration属性を置くときに何らかの理由で例外が発生しました – Daniel

0

WCF Restサービスwebhttpbinding

<bindings> 
    <webHttpBinding> 
    <binding maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> 
     <readerQuotas maxDepth="200" maxStringContentLength="83886089" maxArrayLength="163841" maxBytesPerRead="2147483647" maxNameTableCharCount="16384"/> 
    </binding> 
    </webHttpBinding> 
</bindings> 
関連する問題