我需要使用新包 Azure.Storage.Blobs 从 Azure 存储中获取字节数组格式的文件。我无法找到在 C# 中执行此操作的方法。
public byte[] GetFileFromAzure()
{
byte[] filebytes;
BlobServiceClient blobServiceClient = new BlobServiceClient( "TestClient");
BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient("TestContainer");
BlobClient blobClient = containerClient.GetBlobClient("te.xlsx");
if (blobClient.ExistsAsync().Result)
{
var response = blobClient.DownloadAsync().Result;
using (var streamReader = new StreamReader(response.Value.Content))
{
var line = streamReader.ReadToEnd();
//No idea how to convert this to ByteArray
}
}
return filebytes;
}
Run Code Online (Sandbox Code Playgroud)
知道如何实现获取存储在 Azure Blob 存储上的文件字节数组吗?
感谢帮助。
我收到这个错误,任何人都可以帮助我.可能是我错过了一些步骤:
LongMessage:由于商家配置无效,无法处理此交易.ShortMessage:无效的配置ErrorCode:10501
此致,萨钦