WCF Message Size Specification - wcf

What is Maximum message size (in MB) of incoming and outgoing messages.
maxReceivedMessageSize (what is MAX value we can set with this configuration for basichttp binding)

Run the test client and scroll to the bottom. If you double click the Config File node you will see the XML representation. As you can see the maxReceivedMessageSize is 65536.
the limit is Int64.MaxValue1 which is: 9223372036854775807.

Related

Stream 100 gig file over WCF?

Can I stream 100 Gig file over WCF to an IIS WebService? I am running into
The maximum message size quota for incoming messages (2147483647) has
been exceeded. TO increase the quota, use the MaxReceivedMessageSize
property.
The only problem with that advice is I think I have it set to the max value.
The key is to be sure you are using transferMode="Streamed" (Buffered which is the default will give you OutOfMemoryException) and set MaxReceivedMessageSize to be very large it can hold a long. The real gotcha is that when you do a "Configure Service Reference" sometimes it will remove transferMode="Streamed" and revert you back the default Buffered

Is there any concern in Setting "maxBufferSize" to 1GB of WCF NetTcpBinding

I have a Duplex communication which sends Small as well as Large messages.
In very rare cases I have more data to be send, because of this reason I am in a confusion to change the TransportMode to Streamed.
So I set the buffer size to 1GB (or a Large Size).
maxBufferSize="1073741824"
Is this cause my Small message communication ?
As the setting says this is the maximum buffer size not the buffer size used for all requests. Although maxBufferSize is only used for defining the buffer size for headers when the message is streamed

Maximum binary contents length over WCF/Http

We have a WCF service that has a threshold of 30MB to send files over an http message, anything above that value gets transferred by file copy and the path sent back to the caller. Now we were requested to eliminate that file copy because customers complained it was too slow. So the decision was to remove any size limitation when sending binary content over WCF/HTTP.
My question is - how reliable is that? What type of issues will we encounter by pushing, say, a 2GB file over the wire in a single WCF message, if that is even possible?
Thanks!
If you set the MaxReceivedMessageSize in WCF to a high enough value on your WCF service, you can push a fairly large file through that service. The maximum is int64.MaxValue = 9,223,372,036,854,775,807, so you should be able to set a value to cover a 2GB message.
You might want to control the MaxBufferSize to ensure you're not trying to store too much into memory, and maybe consider switching to the more binary-efficient MTOM message encoding if you can. Note that the MaxReceivedMessageSize governs the size of the message after the binary file has been encoded, which means the original binary file size which can be sent over the service will be smaller than 2GB.
MSDN has a very nice article covering sending large amounts of data over WCF and what to look out for: Large Data and Streaming.
Edit: Turns out the max value allowed is actually Int64.MaxValue)

I keep getting a maximum message size quota for incominng messages (65536) has been exceeded even though I have set mine high

I keep getting this error...
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.
Even though I have my MaxReceivedMessageSize equal to 2147483647... Which is almost an order of magnitude greater than that first number. What on earth is going on?
Did you adjust MaxReceivedMessageSize on both the client-side and server-side?

No exceptions thrown even when maxBufferSize value is smaller than the response message size in WCF

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.
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.