1
votes

I have a wcf operation that sends byte array to client.

The maximum size of byte array I intend to send is 2mb. So I have set maxbuffersize and maxreceivedmessagesize to 2097152 (2 mb) on basichttpbinding with transfermode=buffered on the server.

Despite these settings, no buffer overflow exception is getting thrown if I transfer a 17mb file?

Thanks.

1

1 Answers

1
votes

UPDATE:
My understanding of the buffering in WCF and the effect of the various values was wrong. Please check out this MSDN thread and this related blog post on the ins and outs of WCF buffer management.

However, I still cannot find a definitive answer on how to limit the buffers on the server. From what I understand, if you limit maxBufferPoolSize (total for the pool of all buffers) and maxBufferSize (max. size for a single buffer) on the server side, you should be able to achieve what you're trying to do.

So in your case, you should set maxBufferSize to 2mb on the server, and maxBufferPoolSize to 2mb or more, also on the server. On the client, set the maxReceivedMessageSize also to 2mb.