Solved

Setting binding maxReceivedMessageSize in WCF having no effect

Posted on 2014-04-22
3
1,432 Views
Last Modified: 2014-04-30
I am setting up a chain of WCF services to provide a data access  layer supporting a  business rules layer supporting the UI layer and am having trouble with setting up the bindings (using code, not a config file).

I get the following error:

Additional information: 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.

This is despite setting the MaxReceivedMessageSize (and, for good measure, the MaxBufferSize) to a higher value for the bindings at each level (host and client). The code I am using is shown in the attached document.

Can anyone help, please.
ExpertsExchangeSupport1.docx
0
Comment
Question by:smucRJG2
  • 2
3 Comments
 
LVL 18

Assisted Solution

by:dj_alik
dj_alik earned 500 total points
ID: 40016666
In your host program you need to set the reader quotas  and then add the binding
netBind.Security.Mode = SecurityMode.None
            netBind.MaxBufferPoolSize = 524288
            netBind.MaxReceivedMessageSize = 2147483647
            netBind.MaxBufferSize = 2147483647
            netBind.ReaderQuotas.MaxDepth = 64
            netBind.ReaderQuotas.MaxArrayLength = 2147483647
            netBind.ReaderQuotas.MaxStringContentLength = 2147483647
Make sure that the same maxReceiveMessageSize parameter at the client side also.
The exception clearly indicates that maxReceivedMessageSize is exceeded. Try to capture the WCF traces at verbose level and check what binding configuration is applied on endpoint.
Recheck the client and service configuration and if still no clue, capture traces for service and client at verbose level.

WCF Tracing FAQs
http://www.codeproject.com/Articles/36031/WCF-Tracing-FAQs
0
 

Accepted Solution

by:
smucRJG2 earned 0 total points
ID: 40020136
I think I may have found the answer for my particular case. I was chaining  projects in Visual Studio:
Data Access Service project >> Console hosting project (just for testing)    [solution 1]
>>
Business Service project >> Console hosting project (just for testing)         [solution 2]
>>
UI project      [solution 3]

This way it is possible to step through the complete chain, without using a config file or WCF Test Client, using code needing only minor adjustment before for insertion into final production hosting environment.

After changes to, say, the Data Access Service project I needed to rebuild the project and then remove and re-add the referenced DLL for the project in the associated Console hosting project. This seems to work consistently.

Thank you for the answer - I will keep it in reserve in case I have further problems.
0
 

Author Closing Comment

by:smucRJG2
ID: 40031568
Basically, my solution worked.
Also, I had already spent a lot of time Googling the issue and know that many factors can cause this sort of problem - so dj_alik's response was also a possiblility and relevant (as I had already checkedthat client and server settings were the same).
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
This collection of functions covers all the normal rounding methods of just about any numeric value.
Viewers will learn the different options available in the Backstage view in Excel 2013.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now