문제

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

그리고 메시지 크기와 관련된 다양한 다른 속성을 설정하지만 아무도 작동하지 않는 것 같습니다. 제안이 있습니까? 감사!

도움이 되었습니까?

해결책

설정에 따라 영향을 줄 수있는 다양한 설정이 있습니다.

<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의 "버전"을 정의하고 모든 매개 변수를 더 높은 값으로 설정하면 모든 메시지 크기 (거의)를 얻을 수 있어야합니다.

마음에 : 이것은 거대한 메시지로 범람 할 가능성으로 시스템을 열어 무릎으로 내려갑니다 (클래식 서비스 거부 공격) - 이것이 디자인과 On에 의해 이러한 한계가 상당히 낮게 설정된 이유입니다. 목적.

당신은 그것들을 더 높은 가치로 바꿀 수 있습니다 - 당신이하고있는 일과 보안 위험이 무엇인지, 당신이하는 경우에만 알아야합니다!

마크

추신 : 이러한 설정을 사용하려면 물론 서버 및 클라이언트 측정에서 바인딩 구성을 참조해야합니다.

<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 Services의 최대 메시지 및 버퍼 크기 설정 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