WCFのwebhttpのために最大のメッセージとバッファサイズを設定します

StackOverflow https://stackoverflow.com/questions/1188731

  •  19-09-2019
  •  | 
  •  

質問

私は現在設定のデフォルト設定をオーバーライドすることにより、サービスに入力することができる最大サイズを大きくしようとイムは、私は

のような何かを試してみましたが、webHttpバインディングとWCFサービスを持っています
  <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>

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

役に立ちましたか?

解決

あなたの設定によって影響を与える可能性がある設定の多くがあります - これを試してみます:

<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>

webHttpBindingのあなたの「バージョン」を定義し、より高い値にすべてのこれらのパラメータを設定することで、任意のメッセージサイズ(ほぼ)を介して取得することができる必要があります。

断っておく:これは、巨大なメッセージが殺到しているの電位にあなたのシステムを開くんので、その膝(古典的なサービス拒否攻撃)にまで持ち込むこと - で - それは、これらの制限がかなり低く設定されている理由ですデザインや目的にます。

あなたはより高い値にそれらを変更することができます - ちょうどあなたがやっていることを認識し、何がしなければ、セキュリティ上のリスクは、ある

マルク

PS:これらの設定を利用するためには、あなたはもちろん、サーバーとクライアント側のconfigsでそのバインディング構成を参照する必要があります:

<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>

他のヒント

WCF RESTサービスのwebhttpbindingのために最大のメッセージとバッファサイズを設定する

<bindings>
  <webHttpBinding>
    <binding maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="200" maxStringContentLength="83886089" maxArrayLength="163841" maxBytesPerRead="2147483647" maxNameTableCharCount="16384"/>
    </binding>
  </webHttpBinding>
</bindings>
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top