【问题标题】:maxReceivedMessageSize WCF最大接收消息大小 WCF
【发布时间】:2014-12-03 18:16:03
【问题描述】:

我使用了 WCF 服务,但我遇到了问题

传入邮件的最大邮件大小配额 (65536) 已达到 超过。要增加配额,请使用 MaxReceivedMessageSize 相应绑定元素上的属性。

我修改了MaxReceivedMessageSize,但是没有结果(网上看了很多文章,谁也帮不上忙)

谁知道这件事?

服务配置:

<system.serviceModel>       
   <bindings>           
      <wsHttpBinding>
         <binding name="BindingWithMaxSizeIncreased" 
                  maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
            <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
                          maxArrayLength="2147483647" maxBytesPerRead="2147483647" 
                          maxNameTableCharCount="2147483647" />
         </binding>             
      </wsHttpBinding>      
   </bindings>      
   <services>           
      <service name="FootballLife.MyService" behaviorConfiguration="metadataBehavior">
         <endpoint 
             address="" 
             binding="wsHttpBinding" bindingConfiguration="BindingWithMaxSizeIncreased" 
             contract="FootballLife.IMyService">
            <identity>
               <dns value="localhost"/>
            </identity>
         </endpoint>
         <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>        
   </services>      
   <behaviors>          
      <serviceBehaviors>
         <behavior name="metadataBehavior">
            <serviceMetadata httpGetEnabled="true"/>
            <serviceDebug includeExceptionDetailInFaults="false"/>
         </behavior>            
      </serviceBehaviors>       
   </behaviors>         
   <serviceHostingEnvironment aspNetCompatibilityEnabled="true" 
                              multipleSiteBindingsEnabled="true" />   
</system.serviceModel>

客户端配置

<system.serviceModel>
   <bindings>
      <wsHttpBinding>
          <binding name="BindingWithMaxSizeIncreased"
                   maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
              <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
                            maxArrayLength="2147483647" maxBytesPerRead="2147483647" 
                            maxNameTableCharCount="2147483647" />
          </binding>
      </wsHttpBinding>
   </bindings>
   <client>
      <endpoint 
          address="http://localhost:90/MyService.svc" 
          binding="wsHttpBinding" 
          contract="IMyService">
         <identity>
            <dns value="localhost" />
         </identity>
      </endpoint>
   </client>
</system.serviceModel>

【问题讨论】:

    标签: c# wcf maxreceivedmessagesize


    【解决方案1】:

    您需要在客户端配置中为您的端点提供自定义 bindingConfiguration:

    <endpoint address="http://localhost:90/MyService.svc" 
        binding="wsHttpBinding" 
        contract="IMyService"
        bindingConfiguration="BindingWithMaxSizeIncreased">
        <identity>
            <dns value="localhost" />
        </identity>
    </endpoint>
    

    【讨论】:

      猜你喜欢
      • 2010-09-27
      • 1970-01-01
      • 2010-12-15
      • 2017-05-05
      • 1970-01-01
      • 2015-04-02
      • 2013-11-03
      • 1970-01-01
      • 2010-10-28
      相关资源
      最近更新 更多