【问题标题】:Using WindowsAzure.Storage 8.5 with CloudBlockBlob and BlobAttribute in Azure Functions在 Azure Functions 中使用带有 CloudBlockBlob 和 BlobAttribute 的 WindowsAzure.Storage 8.5
【发布时间】:2018-04-27 15:26:16
【问题描述】:

在使用 WindowsAzure.Storage 7.2.1 时,一个功能很好,但其他功能依赖于 8.5,它们会失败。 如果我使用 WindowsAzure.Storage 8.5 上传 blob 文件,则会引发错误:

Can't bind Blob to type Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob

您将如何解决此类冲突?

这是我上传 blob 的代码:

public static void Run(other params, IBinder binder)
{
        string fileUrl = $"test-blob/{Guid.NewGuid().ToString()}";                   
        var blob = binder.Bind<Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob>(new BlobAttribute(fileUrl));
        blob.UploadText($"test text file: {fileUrl}");
}

【问题讨论】:

标签: azure azure-blob-storage azure-functions


【解决方案1】:

您不能使用任何高于 Functions 运行时使用的 Microsoft.WindowsAzure.Storage 版本(7.2.1 用于函数的 1.x 版本)。从您的项目中删除该引用。

有关更多信息,请参阅Binding redirect support

【讨论】:

  • Functions V2 现已全面上市,在这方面提供了更大的灵活性。
猜你喜欢
  • 2018-02-14
  • 2022-01-20
  • 2019-05-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-01
相关资源
最近更新 更多