WCF的最大邮件大小配额传入消息(65536)已超过? [英] Wcf-The maximum message size quota for incoming messages (65536) has been exceeded?

查看:131
本文介绍了WCF的最大邮件大小配额传入消息(65536)已超过?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

传入消息(65536)的最大邮件大小已超出配额。为了增加配额,使用MaxReceivedMessageSize属性相应绑定元素上。

 < system.serviceModel><服务和GT;
  <服务名称=FileService.Service1behaviorConfiguration =FileService.Service1Behavior>
    <主机>
      < baseAddresses>
        <添加baseAddress =HTTP://本地主机:8732 / Design_Time_Addresses /的FileService /服务1 //>
      < / baseAddresses>
    < /主机>
    <! - 服务端点 - >
    <! - 除非完全合格的,地址是相对于基址上方供给 - >
    <端点地址=绑定=的wsHttpBinding合同=FileService.IService1>
      <! -
          在部署时,下面的身份元素应该被删除或替换,以反映
          身份在其下部署的服务运行。如果删除,WCF会推断出一个合适的身份
          自动。
       - >
      <同一性GT;
        < D​​NS值=本地主机/>
      < /身份>
    < /端点>
    <! - 元数据端点 - >
    &所述;! - 元数据交换端点所使用的服务,以本身描述到客户端。 - >
    < - !此端点不使用安全绑定和部署之前应保证或删除 - >
    <端点地址=MEX绑定=mexHttpBinding合同=IMetadataExchange接口/>
  < /服务>
< /服务>
<&行为GT;
  < serviceBehaviors>
    <行为NAME =FileService.Service1Behavior>
      <! - 为了避免泄露的元数据信息,
      设定值以下为false和部署之前删除上面的元数据终结点 - >
      < serviceMetadata httpGetEnabled =真/>
      <! - 要接收故障中的异常细节进行调试,
      下面设置为true值。设置为false部署之前
      以避免泄露异常信息 - >
      < serviceDebug includeExceptionDetailInFaults =FALSE/>
    < /行为>
  < / serviceBehaviors>
  < /行为>
  < /system.serviceModel>


解决方案

您应该设置maxReceivedMessageSize =2147483647增加邮件大小。尝试改变配置这样的:

 <结合MAXBUFFERSIZE =2147483647
         maxBufferPoolSize =2147483647
         maxReceivedMessageSize =2147483647>
    < readerQuotas MAXDEPTH =2147483647
                  maxStringContentLength =2147483647
                  maxArrayLength =2147483647
                  maxBytesPerRead =2147483647
                  maxNameTableCharCount =2147483647/>
< /&结合GT;

但它是一个不好的做法,增加你的消息值最大值。这可能会导致您与DOS泄漏严重的后患。

更新:

 < system.serviceModel>
  <&绑定GT;
   <&的wsHttpBinding GT;
    <绑定名称=wsBindingmaxReceivedMessageSize =2147483647maxBufferPoolSize =2147483647>
      < readerQuotas maxArrayLength =2147483647maxStringContentLength =2147483647/>
    < /&结合GT;
   < /&的wsHttpBinding GT;
  < /绑定>
  <服务和GT;
  <服务名称=FileService.Service1behaviorConfiguration =FileService.Service1Behavior>
  <主机>
    < baseAddresses>
      <添加baseAddress =HTTP://本地主机:8732 / Design_Time_Addresses /的FileService /服务1 //>
    < / baseAddresses>
  < /主机>
   <端点地址=绑定=的wsHttpBindingbindingConfiguration =wsBinding合同=FileService.IService1>
   <同一性GT;
    < D​​NS值=本地主机/>
   < /身份>
 < /端点> <端点地址=MEX绑定=mexHttpBinding合同=IMetadataExchange接口/>
 < /服务>
 < /服务>
 <&行为GT;
   < serviceBehaviors>
     <行为NAME =FileService.Service1Behavior>
       < serviceMetadata httpGetEnabled =真/>
       < serviceDebug includeExceptionDetailInFaults =FALSE/>
     < /行为>
   < / serviceBehaviors>
 < /行为>
< /system.serviceModel>

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

<system.serviceModel>

<services>
  <service name="FileService.Service1" behaviorConfiguration="FileService.Service1Behavior">
    <host>
      <baseAddresses>
        <add baseAddress = "http://localhost:8732/Design_Time_Addresses/FileService/Service1/" />
      </baseAddresses>
    </host>
    <!-- Service Endpoints -->
    <!-- Unless fully qualified, address is relative to base address supplied above -->
    <endpoint address ="" binding="wsHttpBinding" contract="FileService.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.
      -->
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <!-- Metadata Endpoints -->
    <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
    <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="FileService.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>
  </system.serviceModel>

解决方案

You should set maxReceivedMessageSize="2147483647" to increase message size. Try to change config to this:

<binding maxBufferSize="2147483647" 
         maxBufferPoolSize="2147483647" 
         maxReceivedMessageSize="2147483647">
    <readerQuotas maxDepth="2147483647" 
                  maxStringContentLength="2147483647" 
                  maxArrayLength="2147483647" 
                  maxBytesPerRead="2147483647"
                  maxNameTableCharCount="2147483647" />
</binding>

But it is a bad practice to increase you message values to max value. This can lead you to serious troubles with DOS leaks.

UPDATED:

<system.serviceModel>
  <bindings>
   <wsHttpBinding>
    <binding name="wsBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647"  >
      <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" />
    </binding>
   </wsHttpBinding> 
  </bindings>
  <services>
  <service name="FileService.Service1" behaviorConfiguration="FileService.Service1Behavior">
  <host>
    <baseAddresses>
      <add baseAddress = "http://localhost:8732/Design_Time_Addresses/FileService/Service1/" />
    </baseAddresses>
  </host>
   <endpoint address ="" binding="wsHttpBinding" bindingConfiguration="wsBinding" contract="FileService.IService1">   
   <identity>
    <dns value="localhost"/>
   </identity>
 </endpoint>

 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
 </service>
 </services>
 <behaviors>
   <serviceBehaviors>
     <behavior name="FileService.Service1Behavior">    
       <serviceMetadata httpGetEnabled="True"/>    
       <serviceDebug includeExceptionDetailInFaults="False" />
     </behavior>
   </serviceBehaviors>
 </behaviors>
</system.serviceModel>

这篇关于WCF的最大邮件大小配额传入消息(65536)已超过?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆