指定的Blob不存在-在azure浏览器中显示-但是当我单击下载时不存在

Der*_*nch 6 blob azure

我已将一些Blob上传到azure。当我登录时,它们显示在浏览器中,但是当我尝试下载它们时,出现以下消息:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>BlobNotFound</Code>
<Message>
The specified blob does not exist. RequestId:d3cd1a18-1e48-47bd-9985-4ab7e655eed2 Time:2013-09-19T15:02:16.4158548Z
</Message>
</Error>
Run Code Online (Sandbox Code Playgroud)

屏幕截图浏览(显示斑点)在此处输入图片说明

屏幕截图显示了我单击下载后发生的情况 在此处输入图片说明

Gau*_*tri 7

我想我知道你为什么会遇到这个问题。我相信这是门户的问题。如果您注意到,您的 blob 的名称是:Tommy French Toals.North Street.1250251并且它包含空格。但是,如果您查看 URL,名称将变为:Tommy%2520French%2520Toals.North%2520Street.1250251。注意 的存在%2520。门户软件正在做的是它执行两次 URL 编码 - 首先,它space在 blob 名称中对%20URL 进行编码,然后再次对%符号进行URL 编码%25,这对你来说是一团糟。

再次确认,我在我的存储帐户中上传了一个名称中包含空格的文件,当我尝试通过门户下载 blob 时,它失败并出现与您相同的错误。然后我使用存储客户端库为同一个 blob 创建了一个 SAS URI,它工作得非常好。这是我用于创建 SAS URI 的代码:

        CloudStorageAccount storageAccount = new CloudStorageAccount(new StorageCredentials("myaccount", "myaccountkey"), true);
        var blobContainer = storageAccount.CreateCloudBlobClient().GetContainerReference("mycontainer");
        var blob = blobContainer.GetBlockBlobReference("this file has spaces in its name.txt");
        var sas = blob.GetSharedAccessSignature(new SharedAccessBlobPolicy()
        {
            SharedAccessExpiryTime = DateTime.UtcNow.AddHours(1),
            Permissions = SharedAccessBlobPermissions.Read,
        });
        var sasUrl = blob.Uri.AbsoluteUri + sas;
Run Code Online (Sandbox Code Playgroud)

尝试下载名称中不包含空格或任何特殊字符的文件,它应该可以正常工作。