作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试调用 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/
我是一名优秀的程序员,十分优秀!