1. 程式人生 > >調用WCF時,調用已超過傳入消息(65536)的最大消息大小配額。若要增加配額,請使用相應綁定。

調用WCF時,調用已超過傳入消息(65536)的最大消息大小配額。若要增加配額,請使用相應綁定。

logs eal real reference hostname 配置文件 cal false frame

解決方案:

其實只要在客戶端配置文件中加上如下紫色粗體屬性(

maxReceivedMessageSize):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>

      
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize
="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text"> <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount
="2147483647" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> <binding name="BasicHttpBinding_IService11" maxReceivedMessageSize="2147483647" /> <binding name="BasicHttpBinding_IService2" /> <!--解決- 調用已超過傳入消息(65536)的最大消息大小配額。若要增加配額,請使用相應綁定。只要客戶端配置這個就夠了。2017-10-20 23:45--> <binding name="BasicHttpBinding_IService12" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" /> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:5104/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService11" contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" /> <endpoint address="http://localhost:5104/Service2.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService2" contract="ServiceReference2.IService2" name="BasicHttpBinding_IService2" /> <endpoint address="http://192.168.0.102/winWCF/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService12" contract="ServiceReference3.IService1" name="BasicHttpBinding_IService11" /> </client> </system.serviceModel> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>

服務端不用配置如下的節點:

技術分享

如果還是不對,則可以用vs中工具欄下的==》WCF服務配置編輯器打開客戶端.cofig查看是否正確配置。

技術分享

調用WCF時,調用已超過傳入消息(65536)的最大消息大小配額。若要增加配額,請使用相應綁定。