1

我正在使用Silverlight 多文件上传器并将 Azure Blob 中的文档作为字节数组上传。

//Append the memory stream into ByteArray
using (MemoryStream ms = new MemoryStream())
{
     stream.CopyTo(ms);
     return ms.ToArray();
 }

// Upload the file
blob.UploadByteArray(bytes);

上传文档似乎间歇性损坏。

有什么建议么?

4

1 回答 1

0

The Windows Azure Storage Client Library protects the integrity of the blob being uploaded by verifying an MD5 hash of the data when it is sent to the Windows Azure Storage Service (in most cases). If you are using an HTTPS connection to the service, this would also verify the data was sent without errors.

The details of how MD5 hashes are used: http://blogs.msdn.com/b/windowsazurestorage/archive/2011/02/18/windows-azure-blob-md5-overview.aspx

I believe the corruption you are seeing occurred between the client's web browser and your application. You will need to have the user try their upload again.

By the way, your code creates two additional copies of the data unnecessarily (MemoryStream and byte array). Instead, try this:

blob.UploadFromStream(stream);
于 2013-09-26T01:37:04.103 回答