Thursday, September 08, 2011

Maximum message size quota for incoming messages (65536) has been exceeded even though maxReceivedMessageSize has been set

I was getting this error in the server side WCF trace messages. The weird thing was that the maxReceivedMessageSize was set on the bindingConfiguration (shown below):

image

After a lot of time trying to debug the issue I figured out the issue: the name that I had set on the service was not correct and it did not point to the name of the class that implemented the contract. This I think resulted in a default configuration getting applied to the service and hence the bindingBehavior that I had defined was not being applied to the service. Once I corrected the name, everything began working correctly.

So make sure your service’s name is set correctly.

image

Remember: name. Specifies the type that provides an implementation of a service contract. This is a fully qualified name which consists of the namespace, a period, and then the type name. For example "MyNameSpace.myServiceType". (MSDN)

Note: If you want to use a name other than the class name, then you can use the ServiceBehavior (MSDN) attribute on your class to give it a different name.

References:

Control generated WSDL in WCF - Part 1. Namespaces.
http://www.pluralsight-training.net/community/blogs/kirillg/archive/2006/06/18/28380.aspx

Service versioning
http://msdn.microsoft.com/en-us/library/ms731060.aspx

No comments: