Pregunta

Actualmente tengo un servicio WCF con fijaciones webHttp, im tratando de aumentar el tamaño máximo que puede ser introducida en el servicio reemplazando los valores por omisión de configuración, he intentado hacer algo como

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

y el establecimiento de varias otras propiedades pertenecientes a tamaño de los mensajes, pero ninguno parece estar funcionando, se puede incluso cambiar el tamaño de m ensaje de una vinculación webHttp? ¿Alguna sugerencia? Gracias!

¿Fue útil?

Solución

Hay una multitud de ajustes que podrían tener una influencia dependiendo de la configuración - intente esto:

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

Al definir su "versión" de la webHttpBinding y ajustar todos los parámetros a los valores más altos, usted debería ser capaz de conseguir a través de cualquier tamaño de mensajes (casi).

Eso sí: esto hace abrir el sistema para que el potencial de ser inundado con grandes mensajes y por lo tanto ser llevados hasta sus rodillas (clásicos ataques de denegación de servicio) - que es la razón de que estos límites se establecen bastante baja - por diseño y propósito.

Puede cambiarlos a valores más altos - acaba de ser conscientes de lo que está haciendo y cuáles son los riesgos de seguridad son, si lo hace

!

Marc

PS: Con el fin de hacer uso de estos ajustes, por supuesto, hay que hacer referencia a que la configuración de enlace en su servidor y del lado del cliente configuraciones:

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

Otros consejos

Configuración máxima de los mensajes y el tamaño de búfer para los servicios REST WCF webhttpbinding

<bindings>
  <webHttpBinding>
    <binding maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="200" maxStringContentLength="83886089" maxArrayLength="163841" maxBytesPerRead="2147483647" maxNameTableCharCount="16384"/>
    </binding>
  </webHttpBinding>
</bindings>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top