我现在有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>

和设置各种其它特性有关的消息的大小,但没有似乎是工作,可以在一个甚至改变webHttp结合的米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