简体   繁体   English

WCF的maxReceivedMessageSize

[英]maxReceivedMessageSize WCF

I consume a WCF service, but I have a problem 我使用了WCF服务,但是有问题

The maximum message size quota for incoming messages (65536) has been exceeded. 超出了传入消息的最大消息大小配额(65536)。 To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element. 要增加配额,请在适当的绑定元素上使用MaxReceivedMessageSize属性。

I have modified MaxReceivedMessageSize , but there is no result (I read many articles in the internet, but anyone can't help) 我已经修改了MaxReceivedMessageSize ,但是没有结果(我在互联网上阅读了很多文章,但是任何人都无法帮助)

Who knows about this? 谁知道这个?

Service.config: 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 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>

You need to give the custom bindingConfiguration to your endpoint in the client configuration: 您需要在客户端配置中将自定义bindingConfiguration赋予端点:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM