How to set the MaxReceivedMessageSize programatically when using a WCF Client?
Posted
by Pratt
on Stack Overflow
See other posts from Stack Overflow
or by Pratt
Published on 2010-03-16T19:22:18Z
Indexed on
2010/03/16
19:31 UTC
Read the original article
Hit count: 221
wcf
I want to set the MaxReceivedMessageSize property to some higher limit (Due to (400) Bad Request error) in my client programatically. This is the code I am using...
WCFServiceTestClient wcfClient =
new WCFServiceTestClient(new wsHttpBinding(), strServiceURL);
My service url is dynamic and hence cannot use the web.config.
//The following code doesnt seem to take effect
((WSHttpBinding)wcfClient.ChannelFactory.Endpoint.Binding)
.MaxReceivedMessageSize = 2147483647;
What am I doing wrong?
Any help is appreciated.
Thanks
Pratt
© Stack Overflow or respective owner