我按照这篇文章(WCF - How to Increase Message Size Quota)并将MaxBuffer大小设置为最大大小,我仍然得到错误。我还能改变什么?
我使用Fiddler查看响应,它是67,934字节。以下是绑定。
<basicHttpBinding>
<binding name="MCPClaimsService_InterfaceSOAP"
maxReceivedMessageSize="21474836470"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="32"
maxArrayLength="2147483647"
maxStringContentLength="2147483647"/>
</binding>
</basicHttpBinding>
此代码具有自定义绑定。我没有写。
public static CustomBinding HttpsSSLBinding()
{
var textmessageEncoding = new TextMessageEncodingBindingElement();
textmessageEncoding.WriteEncoding = Encoding.UTF8;
textmessageEncoding.MessageVersion = MessageVersion.Soap11;
MessageSecurityVersion securityVersion = MessageSecurityVersion.WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10;
AsymmetricSecurityBindingElement bindingElement =
(AsymmetricSecurityBindingElement)SecurityBindingElement.CreateMutualCertificateBindingElement(securityVersion, true);
bindingElement.SetKeyDerivation(false);
bindingElement.EnableUnsecuredResponse = true;
X509SecurityTokenParameters istp = bindingElement.InitiatorTokenParameters as X509SecurityTokenParameters;
if (istp != null)
{
istp.X509ReferenceStyle = X509KeyIdentifierClauseType.IssuerSerial;
istp.InclusionMode = SecurityTokenInclusionMode.Never;
}
X509SecurityTokenParameters rstp = bindingElement.RecipientTokenParameters as X509SecurityTokenParameters;
if (rstp != null)
{
rstp.X509ReferenceStyle = X509KeyIdentifierClauseType.IssuerSerial;
rstp.InclusionMode = SecurityTokenInclusionMode.Never;
}
HttpsTransportBindingElement transport = new HttpsTransportBindingElement();
return new CustomBinding(bindingElement, textmessageEncoding, transport);
}
}
答案 0 :(得分:2)
在我意识到除了app.config中的绑定语句之外它还有自定义绑定之后,我将下面的行添加到自定义绑定代码中,这解决了问题。希望浪费我的时间将来会帮助某人。
transport.MaxBufferSize = 2147483647;
transport.MaxReceivedMessageSize = 2147483647;
transport.MaxBufferPoolSize = 2147483647;