【发布时间】:2020-12-29 20:31:41
【问题描述】:
我正在努力将我们的 Azure Blob 存储 (WindowsAzure.Storage) 包从折旧的 9.3.3 版本更新为 Microsoft.Azure.Storage.Blob 替代品。这需要更新 Microsoft.Azure.WebJobs:v2.2.0 到 v3.0.x。在完成包更新和对 azure 功能的以下签名修订后;由于 TraceWriter 导致以下错误(修订版 1),它将不再运行:
Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'traceLog' to type TraceWriter. 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.).
然后我尝试将其转换为 ILogger(修订版 2),并得到了类似的错误:
Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'traceLog' 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 Functions v1.x 能否针对 Microsoft.Azure.WebJobs 从 v2.2.0 更新到 v3.0.x?还是 Azure Functions v1.x 依赖于 Microsoft.Azure.WebJobs v2.2.x?我缺少什么配置来连接日志?
环境
Azure Functions = 1.38
Target Framework = .NET Framework 4.8
-原创-
[FunctionName("PlaceOrder")]
public static void OrderImport([BlobTrigger("pending/{filename}", Connection = "storage")]Stream inputBlob, string filename, TraceWriter traceLog)
-修订版 1-
[FunctionName("PlaceOrder")]
public static void OrderImport([Blob("pending/{filename}", Connection = "storage")]Stream inputBlob, string filename, TraceWriter traceLog)
-修订版 2(使用 ILogger)-
[FunctionName("PlaceOrder")]
public static void OrderImport([Blob("pending/{filename}", Connection = "storage")]Stream inputBlob, string filename, ILogger traceLog)
【问题讨论】:
-
Microsoft 在他们的文档docs.microsoft.com/en-us/azure/azure-functions/… 中谈到了从 1.x 迁移到较新版本的问题,此外 2.x + 不支持 .NET Framework
标签: c# azure-functions