2021年5月28日 星期五

[研究] Microsoft Azure 雲端平台程式出錯「The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.」

[研究] Microsoft Azure 雲端平台程式出錯「The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.」

2021-05-28

Visual Studio 2019 追蹤發現

// http://<account>.blob.core.windows.net/<container>/<blobname>;

string fileInBlobUrl = (string)e.CommandArgument;   // ex: https://XXXstorage.blob.core.windows.net/container01/001.png

string blobName = GetFileName(fileInBlobUrl);

var blob = this.GetContainer(RadioButtonList1.SelectedItem.Value).GetBlockBlobReference(blobName);

blob.FetchAttributes(); // 提取屬性,否則 blob.Properties.Length 會 -1  // 有問題  The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

byte[] buffer = new byte[blob.Properties.Length];


上面要補上 blob.FetchAttributes();
否則 blob.Properties.Length 是 -1

(完)

沒有留言:

張貼留言