gpt4 book ai didi

Azure Function 无法绑定(bind) ILogger

转载 作者:行者123 更新时间:2023-12-03 11:36:01 24 4
gpt4 key购买 nike

我的函数正在引用一个引用 Microsoft.Extensions.Logging.Abstractions 2.0.0 的程序集。如果我将对该版本的 nuget 引用添加到函数的程序集中,函数执行将失败并显示:

[1/25/2018 11:14:46 PM] Microsoft.Azure.WebJobs.Host: Error indexing method 'TrainingFunction.Run'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'log' to type ILogger. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).

是否可以在 Azure 函数中使用较新的记录器?(SDK 1.0.7)

最佳答案

可能发生的情况是,SDK 绑定(bind)到 ILogger 程序集的版本 X,而您的用户代码绑定(bind)到版本 Y。然后,绑定(bind)引擎不会将您的参数类型识别为相同,因为它们来自不同的组件。 (任何其他类型也可能发生这种情况)。

通常修复方法是:

  1. 查看 SDK 使用的 block 引用
  2. 使用现有的引用,并且不要添加不同版本的相同 dll。

关于Azure Function 无法绑定(bind) ILogger,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48453482/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com