小编Sac*_*hin的帖子

如何使用 C# 中的 Azure.Storage.Blobs 从 Azure 存储 blob 获取 ByteArray 格式的文件

我需要使用新包 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 存储上的文件字节数组吗?

感谢帮助。

.net c# azure azure-storage azure-blob-storage

15
推荐指数
1
解决办法
2万
查看次数

LongMessage:由于商家配置无效,无法处理此交易.ShortMessage:无效的配置ErrorCode:10501

我收到这个错误,任何人都可以帮助我.可能是我错过了一些步骤:

LongMessage:由于商家配置无效,无法处理此交易.ShortMessage:无效的配置ErrorCode:10501

此致,萨钦

paypal paypal-sandbox nopcommerce

4
推荐指数
1
解决办法
6018
查看次数