Reputation: 37
I tried to to call TransferManager.UploadAsync
but I keep getting this error:
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.
This is my method in 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();
}
Upvotes: 2
Views: 856
Reputation: 25583
In my case, this happened when I installed NuGet package Microsoft.Azure.Storage.Common
v11.1.7 but forgot to install Microsoft.Azure.Storage.Blob
Upvotes: 3
Reputation: 21
This issue is resolved in the latest release. Upgrade your Azure packages to 11.1.7 https://github.com/Azure/azure-storage-net-data-movement/issues/223
Upvotes: 2