Solved

Setting binding maxReceivedMessageSize in WCF having no effect

Posted on 2014-04-22
3
1,473 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

This collection of functions covers all the normal rounding methods of just about any numeric value.
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 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 use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

733 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