2014-12-03 86 views
0

予消耗的WCF服务,但是我有一个问题maxReceivedMessageSize WCF

的最大消息大小配额用于传入消息(65536)一直 超出。要增加配额,请在适当的绑定元素上使用MaxReceivedMessageSize 属性。

我已经修改MaxReceivedMessageSize,但没有结果(我看了网上很多文章,但任何人都不能帮助)

谁知道这件事吗?

Service.config:

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

Client.config

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

回答

1

你需要给自定义bindingConfiguration在客户端配置您的端点:

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