WCF HttpClient Error calling a RESTful WCF Service - Cannot write more bytes to the buffer than the configured maximum buffer size: 65536

Posted by Justin Hoffman on Geeks with Blogs See other posts from Geeks with Blogs or by Justin Hoffman
Published on Fri, 04 Mar 2011 18:10:45 GMT Indexed on 2011/03/05 23:26 UTC
Read the original article Hit count: 311

Filed under:

Using the HttpClient API from wcf.codeplex.com, you may encounter this error if respones are too large.  

Cannot write more bytes to the buffer than the configured maximum buffer size: 65536

In order to increase the size of the Response Buffer, just increase the MaxReseponseContentBufferSize as shown below. Increase it to something larger than the default: 65536 depending on your response sizes.

     
var client = new HttpClient
{
MaxResponseContentBufferSize = 196608,
BaseAddress = new Uri("http://myservice/service1/")

};

© Geeks with Blogs or respective owner