gpt4 book ai didi

c# - 将文件上传到 blob 存储错误 get_NetworkTimeout 没有实现

转载 作者:行者123 更新时间:2023-12-02 06:15:54 25 4
gpt4 key购买 nike

我尝试调用 TransferManager.UploadAsync 但我不断收到此错误:

Method 'get_NetworkTimeout' in type 'Microsoft.Azure.Storage.File.FileRequestOptions' from assembly 'Microsoft.Azure.Storage.File, Version=11.1.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.

这是我在 BaseBlobRepository.cs 中的方法:

public void Add(string name, System.IO.Stream fileStream, string contentType = null)
{
TransferManager.Configurations.ParallelOperations = 64;
SingleTransferContext context = new SingleTransferContext();
context.ProgressHandler = new Progress<TransferStatus>((progress) =>
{
Console.WriteLine("Bytes uploaded: {0}", progress.BytesTransferred);
});
var container = GetBlobContainer(_containerName);
CloudBlockBlob blockBlob = container.GetBlockBlobReference(name);
if (contentType != null)
{
blockBlob.Properties.ContentType = contentType;
}
var task = TransferManager.UploadAsync(
fileStream, blockBlob, null, context, CancellationToken.None);
task.Wait();
}

最佳答案

就我而言,当我安装 NuGet 包 Microsoft.Azure.Storage.Common v11.1.7 但忘记安装 Microsoft.Azure.Storage.Blob

关于c# - 将文件上传到 blob 存储错误 get_NetworkTimeout 没有实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62471879/

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