Maximum Size of a SOAP Message
From time to time I wonder who comes to read this blog and why, but those kinds of questions are very hard to answer from the meager server data I can view. Such is life when you're on a hosted service, although life is not bad at blogs.msdn.com. Some small fraction of the total viewership actually leads to a referer being collected, which I can look at. Word keeps trying to correct the spelling of that word to referrer, an assistance technology sadly missing at the time the HTTP standard was written. In any case, it's somewhat interesting to look at the referrals from search engines that include the search terms in the URL.
Evidently, quite a few people are interested in knowing what the maximum size can be for a SOAP message. While Google thinks this blogs holds the answer, that will be much more true after today's post.
Technically speaking, the maximum, MAXIMUM size of a SOAP message that we can process in WCF is 9,223,372,036,854,775,807 bytes. You'll have to knock off a few hundred bytes to account for the headers. Those are included in that limit along with the message body.
There is the small caveat that that is really only the limit for messages sent using streamed transfers. If you're using buffered transfer, then we have to allocate some kind of backing store for the message. Most implementations are going to use an array for that store, limiting the total possible message size to 2,147,483,647 bytes. Custom channel authors can go crazy here although I think it's unlikely that many will choose to take advantage of this extensibility point.
However, even if you happen to have that much memory, that allocation isn't going to succeed on a 32-bit platform. There's a bit less than 2 GB of addressable space in your process and some of that will be taken or fragmented into smaller pieces. Actually, you're doing pretty good most of the time if you can allocate an array of a few hundred megabytes in size with a 32-bit operating system.
All of that of course is contingent on you permitting your program to receive messages of such sizes. The transport quota settings overview I posted a few days ago talks about the MaxReceivedMessageSize quota and how to set it. Unless you increase the size of that setting, you'll never see a message larger than the default maximum of 64 KB. We don't limit the maximum size of outgoing message, although it is very possible that someone on the other end of the connection will take exception if you choose to send oversized messages.
Comments
- Anonymous
June 21, 2006
I've talked about the framing that goes on in the network stack before, but today's topic is a case where... - Anonymous
February 19, 2007
I haven't forgotten about the goal to put together a table of contents for all of these articles. The