使用 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/