azure - 在 Azure Functions 中将 WindowsAzure.Storage 8.5 与 CloudBlockBlob 和 BlobAttribute 结合使用

标签 azure azure-blob-storage azure-functions

使用 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}");
}

最佳答案

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

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

关于azure - 在 Azure Functions 中将 WindowsAzure.Storage 8.5 与 CloudBlockBlob 和 BlobAttribute 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50065634/

相关文章:

Powershell Azure : The term 'Get-AutomationConnection' is not recognized as the name of a cmdlet, 函数、脚本文件或可运行程序

asp.net - 空闲超时后 MVC 5 应用程序 Azure/IIS 错误

python - sas生成的blob url向azure ocr api发送错误请求400

azure - 如何将 blob 添加到 Windows Azure?

azure - 无法在 Azure Function 中创建编排函数

java - MongoDB静态连接错误: Syntax error on tokens,AnnotationName需要代替

Azure Function v2 - 如何将配置加载为单例?

azure - SignalR 和 Azure - 消息传递不可靠?

azure - Terraform - Azure 负载均衡器规则 - 引用前端 IP

ios - ssl中Client Hello包中mshkg000019.blob.core.windows.net的含义