Onk*_*kar 66 wcf basichttpbinding
我为几个表创建范围时得到了这个异常,所有这些表都是巨大的设计
<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>
Run Code Online (Sandbox Code Playgroud)
我已经做到MaxReceivedMessageSize
2147483647,但它仍然在这条线下给我以下例外
client.GetTableDescription(scopeName, syncTable)
Run Code Online (Sandbox Code Playgroud)
已超出传入邮件的最大邮件大小限额(65536).
要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性.
Seb*_*ada 103
按照这个问题的答案
你会想要这样的东西:
Run Code Online (Sandbox Code Playgroud)<bindings> <basicHttpBinding> <binding name="basicHttp" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000"> <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/> </binding> </basicHttpBinding> </bindings>
还请阅读那里接受的答案的评论,其中包含有价值的意见.
RQD*_*QDQ 12
您还需要增加maxBufferSize.另请注意,您可能需要增加readerQuotas.
p_c*_*amp 12
更新配置对我不起作用,但我能够以编程方式编辑绑定:
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;
}
Run Code Online (Sandbox Code Playgroud)
您需要在SERVER和CLIENT上的绑定配置(在app.config文件中)进行更改,否则它将不会生效.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding maxReceivedMessageSize="2147483647 " max...=... />
</basicHttpBinding>
</bindings>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
如果您使用的是CustomBinding,则需要在httptransport元素中进行更改.将其设置为
__CODE__
这对我有用:
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
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
94461 次 |
最近记录: |