user1091524
user1091524

Reputation: 865

basicHttpBinding maxBufferSize

I followed this post (WCF - How to Increase Message Size Quota) and set the MaxBuffer size the largest size it can be and I still get the error. What else could I change?

I used Fiddler to view the response and it is 67,934 bytes. Below is the binding.

<basicHttpBinding>
    <binding name="MCPClaimsService_InterfaceSOAP"
             maxReceivedMessageSize="21474836470"
             maxBufferSize="2147483647"
             maxBufferPoolSize="2147483647">
      <readerQuotas maxDepth="32"
                maxArrayLength="2147483647"
                maxStringContentLength="2147483647"/>
    </binding>
</basicHttpBinding>

This code has a custom binding. I did not write it.

       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);
       }
   }

Upvotes: 1

Views: 2260

Answers (1)

user1091524
user1091524

Reputation: 865

After I realized it had a custom binding in addition to the binding statement in app.config I added the lines below to the custom binding code and that solved the problem. Hopefully this waste of my time will help someone in the future.

           transport.MaxBufferSize = 2147483647;
           transport.MaxReceivedMessageSize = 2147483647;
           transport.MaxBufferPoolSize = 2147483647;

Upvotes: 2

Related Questions