Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Getting the following error when testing my wcf email service (this error happens *only* when sending a very large attachment through the new email service - obviously when the size of the attachment is larger than 65536):

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

The question is, I am already setting the MaxReceivedMessageSize property in my web.config to a large value of 500000000, I also used the following code to set the binding in the code of the client itself as well as the service but no change:

C#
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
              binding.CloseTimeout = new TimeSpan(00, 5, 00);
              binding.OpenTimeout = new TimeSpan(00, 5, 00);
              binding.ReceiveTimeout = new TimeSpan(00, 5, 00);
              binding.SendTimeout = new TimeSpan(00, 5, 00);
              binding.TextEncoding = System.Text.Encoding.UTF8;
              binding.MaxReceivedMessageSize = 500000000; // int.MaxValue;
              binding.MaxBufferSize = 500000000; // int.MaxValue;


One thing to mention, having set the code above prior to calling the service, do I need to somehow associate the "binding" object with the message prior to calling the service?

Thanks for the help upfront.
Posted

1 solution

Solved! problem with behavior configuration, removed all of it and re created it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900