传入消息的最大消息大小限额(65536)已被超出

在创buildless量表的范围时,我得到这个exception,所有这些表都是巨大的devise

<bindings> <wsHttpBinding> <binding name="wsHttpBinding_ISyncServices" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Message"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""> <extendedProtectionPolicy policyEnforcement="Never" /> </transport> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" /> </security> </binding> </wsHttpBinding> </bindings> 

我已经将MaxReceivedMessageSize为2147483647,但是在这条线上还是给出了一个例外

  client.GetTableDescription(scopeName, syncTable) 

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

根据这个问题的答案

你会想要这样的东西:

 <bindings> <basicHttpBinding> <binding name="basicHttp" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000"> <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/> </binding> </basicHttpBinding> </bindings> 

也请阅读那些被接受的答案,其中包含有价值的意见。

您还需要增加maxBufferSize 。 另外请注意,您可能需要增加readerQuotas 。

如果你使用CustomBinding,那么你需要在httptransport元素中进行更改。 设置为

<customBinding> <binding ...> ... <httpsTransport maxReceivedMessageSize="2147483647"/> </binding> </customBinding>

这对我工作:

  Dim binding As New WebHttpBinding(WebHttpSecurityMode.Transport) binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None binding.MaxBufferSize = Integer.MaxValue binding.MaxReceivedMessageSize = Integer.MaxValue binding.MaxBufferPoolSize = Integer.MaxValue 

您需要在服务器和客户端上的绑定configuration(在app.config文件中)进行更改,否则将不会生效。

 <system.serviceModel> <bindings> <basicHttpBinding> <binding maxReceivedMessageSize="2147483647 " max...=... /> </basicHttpBinding> </bindings> </system.serviceModel> 

改变configuration没有帮助我。 以下工作良好

 private YourAPIClient GetClient() { Uri baseAddress = new Uri(APIURL); var binding = new BasicHttpBinding(); binding.MaxReceivedMessageSize = 20000000; binding.MaxBufferSize = 20000000; binding.MaxBufferPoolSize = 20000000; binding.AllowCookies = true; var readerQuotas = new XmlDictionaryReaderQuotas(); readerQuotas.MaxArrayLength = 20000000; readerQuotas.MaxStringContentLength = 20000000; readerQuotas.MaxDepth = 32; binding.ReaderQuotas = readerQuotas; if (baseAddress.Scheme.ToLower() == "https") binding.Security.Mode = BasicHttpSecurityMode.Transport; var client = new YourAPIClient(binding, new EndpointAddress(baseAddress)); return client; } 

我的解决scheme是在我的查询中使用“-OutBuffer 2147483647”参数,这是Common Parameters的一部分。 PS C:> Get-Help about_CommonParameters -Full