WCF MaxStringContentLength
I've maxed out my maxStringContentLength
when passing arguments from WCF to WCF.
No biggie, I'll just up the value. But I have a question before I do:
Is that default 8192 size in bits, bytes, characters, words or what?!?!
I've been here (http://msdn.microsoft.com/en-us/library/system.xml.xmldictionaryreaderquotas.开发者_如何转开发maxstringcontentlength.aspx
), but apparently it's a big secret and nobody's supposed to know.
It's in bytes. The default is 8K.
Edited To Add
Actually, the documentation in one place says character, so characters is probably the more correct answer. Bytes works though if you're dealing with the normal 255 ASCII characters, as one byte = one character.
The length is in chracters, as mentioned by Tim (it's essentially the result of string.Length). One more thing to add - the correlation between bytes and characters really depends on the encoding which is used. For normal "text" XML, if you use UTF-8 each character can be represented by 1, 2 or 3 bytes. If you use UTF-16, it'll be always 2 bytes per character. If you use the binary XML (i.e., with the BinaryMessageEncodingBindingElement), it's possible that you have some dictionary strings in the content, and they can take only a few bytes, but they can be expanded to large string values - and MaxStringContentLength is one of the quotas prevents a malicious client from sending a small number of bytes that cause a large allocation of memory in the server.
精彩评论