Solved

Setting binding maxReceivedMessageSize in WCF having no effect

Posted on 2014-04-22
3
1,490 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

696 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