简体   繁体   English

可以添加到Azure队列的base64编码字符串的最大长度是多少?

[英]What is the maximum length of base64 encoded string that can be added to Azure queue?

I need to send compressed Base64 data over an Azure queue, which has a limitation of 64K. 我需要通过Azure队列发送压缩的Base64数据,该队列的限制为64K。
My code compresses the data and then encodes it as a Base64 string. 我的代码压缩数据,然后将其编码为Base64字符串。
I verify the compressed and encoded string does not exceed 64000 bytes (see encodedLen below), however, my code crashed when I tried to add a message of ~57,000 bytes . 我验证压缩和编码的字符串不超过64000字节(请参阅下面的encodedLen),但是,当我尝试添加~57,000字节的消息时,我的代码崩溃了。

var byteString = Encoding.UTF8.GetBytes(articleDataToSend);  
var compressed = QuickLZ.compress(byteString, 1);  
var encoded = Convert.ToBase64String(compressed);  

var encodedLen = Encoding.UTF8.GetByteCount(encoded);  
if(encodedLen < 64000)
{
    QueueMessage(_nlpInputQueue, encoded);
}

I'm using Visual Studio 2012 and .Net 4.5. 我正在使用Visual Studio 2012和.Net 4.5。
What am I missing here? 我在这里错过了什么?

Maximum message size is 48k when using Base64 encoding http://msdn.microsoft.com/en-us/library/windowsazure/hh767287.aspx 使用Base64编码时,最大邮件大小为48k http://msdn.microsoft.com/en-us/library/windowsazure/hh767287.aspx

Use Azure Service Bus Queues and you can get up to 256k 使用Azure Service Bus Queues,您最多可以获得256k

I believe you're ending up with a double-encoded string. 我相信你最终会得到一个双重编码的字符串。 The storage client library has historically base64-encoded everything put on a queue, so it's base64-encoding your base64-encoded string. 存储客户端库历史上基于64位编码放在队列中的所有内容,因此它是base64编码的base64编码字符串。 My guess is that if you did QueueMessage(_nlpInputQueue, compressed) instead, this would work. 我的猜测是,如果你QueueMessage(_nlpInputQueue, compressed) ,这将有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM