?
Solved

Setting binding maxReceivedMessageSize in WCF having no effect

Posted on 2014-04-22
3
Medium Priority
?
1,523 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 1000 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
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 …
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…

765 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