gpt4 book ai didi

c# - Azure.RequestFailedException : 'Service request failed. 状态 : 404 (The specified blob does not exist. )错误代码:BlobNotFound

转载 作者:行者123 更新时间:2023-12-03 01:21:46 25 4
gpt4 key购买 nike

亲爱的开发者您好,

我面临的问题是无法读取/访问我的 Azure 存储帐户上的 blob 文件。我使用 C# 作为编程语言。最后,我想读取我的 blob 文件来搜索特定值并检查其是否为真。预先感谢您<3

这就是我的代码的样子。

            //Get a reference to the edc(1.3) container
string containerName = "edc/rchexport/rch-bu-party-dd/1.3";
string connectionString = "DefaultEndpointsProtocol=https;AccountName=adlse3.....";

Log.Information($"C# Timer trigger function executed at: {DateTime.Now}");
BlobContainerClient blobContainerClient = new BlobContainerClient(connectionString, containerName);


//Acces to parquet blob file. Getting the sample structure of the blob to create the final table.
string edcRchBuParty = "rchtestdata.parquet";
BlobClient st5BobClient = blobContainerClient.GetBlobClient(edcRchBuParty);
var sampleStream = st5BobClient.OpenRead(); **<<<<<<<<< This where the error pops up**.
var sampleReader = new ParquetReader(sampleStream);

Table sampleTable = sampleReader.ReadAsTable();
DataField[] datafields = sampleTable.Schema.GetDataFields();
Table finalTable = new Table(datafields);
//looping through the container for getting the blobs and read the file and add the rows to the final table
await foreach (BlobItem blobItem in blobContainerClient.GetBlobsAsync())
{
if (blobItem.Name.Contains("15b0251556c74fd693ca1f3cb4ce4d6e")) //for testing
{
Log.Information("\t" + blobItem.Name);
BlobClient blobClient = blobContainerClient.GetBlobClient(blobItem.Name);
var stream = blobClient.OpenRead();
var reader = new ParquetReader(stream);
Table table = reader.ReadAsTable();
Console.WriteLine("Step 3 : Check");
foreach (Row row in table)
{
finalTable.Add(row);
}
Log.Information(finalTable.Count.ToString());
}

最佳答案

问题在于您如何指定容器名称。

查看您的代码,我猜测您的容器名称是 edc 并且您的 blob (rchtestdata.parquet) 存在于像 rchexport/这样的文件夹层次结构中rch-bu-party-dd/1.3

如果是这种情况,请更改以下代码行:

string containerName = "edc/rchexport/rch-bu-party-dd/1.3";

string containerName = "edc";

并更改以下代码行:

string edcRchBuParty = "rchtestdata.parquet";

string edcRchBuParty = "rchexport/rch-bu-party-dd/1.3/rchtestdata.parquet";

那么您不应该收到此错误。

关于c# - Azure.RequestFailedException : 'Service request failed. 状态 : 404 (The specified blob does not exist. )错误代码:BlobNotFound,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69647791/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com