admin管理员组

文章数量:1123198

My C# program downloads a list of files from an Azure Storage blob using Azure.StorageServices.BlobService. But once it reaches a particular mono-2.0-bdwgc.dll file, I get a Response failed with status: 403 Forbidden response.

  • All of the downloaded files can be accessed anonymously. In fact, I can even open the [...]/mono-2.0-bdwgc.dll URI in a browser and it downloads the file with no issue.

  • If explicitly try to download the file at the start of the program, it also downloads it just fine. It only seems to complain if I try while downloading the whole list of blobs.

A barebones excerpt of my code:

StorageServiceClient client = StorageServiceClient.Create(STORAGE_ACCOUNT, blobKey);
blobService = client.GetBlobService();

...

for (int i = 0; i < blobsToDownload.Count; i++)
{
    await blobService.GetBlob(OnBlobReceived, blobsToDownload[i]);
}
private async void OnBlobReceived(IRestResponse<byte[]> response)
{
    if (response.IsError)
    {
        // This fails with 403 Forbidden
        throw new Exception($"{(int)response.StatusCode} {response.ErrorMessage} {response.Url}");
    }
    ...
}

I've noticed Microsoft recently changed the recommended x-ms-version header on MSDN to 2025-01-05, so I followed suit, but nothing changed.

Does anyone know why it would fail on this particular file on this particular occasion?

本文标签: cAnonymous blob download sometimes return 403 ForbiddenStack Overflow