【发布时间】:2021-09-22 21:54:05
【问题描述】:
我正在编写一个订阅 Cosmos DB 更改源的 Azure Function 应用。当我使用 Visual Studio 2019 在本地运行应用程序 (F5) 时,我在 CLI 上收到以下错误:
Azure Function Core Tools reports "No job functions found."
整个代码sn-p如下:
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
namespace ZZZ.ChangeFeedSubscriber
{
public static class ChangeFeedSubscriber
{
[FunctionName("ChangeFeedSubscriber")]
public static void Run([CosmosDBTrigger(
databaseName: "XXX",
collectionName: "YYY",
ConnectionStringSetting = "XXX",
LeaseCollectionName = "leases")] IReadOnlyList<Doc> docs, FunctionContext context)
{
var logger = context.GetLogger("ChangeFeedSubscriber");
if (docs != null && docs.Count > 0)
{
logger.LogInformation("Documents modified: " + docs.Count);
foreach (var doc in docs)
{
logger.LogInformation("ID: " + doc.id);
}
}
}
}
}
我尝试在应用程序参数上设置“--verbose”以查看日志输出,但它引发了错误。
Adding "--verbose" throws an error.
Result of adding "--verbose" to application arguments.
我也尝试设置“start --verbose”,但也报错了。
Adding "start --verbose" also throws an error.
Result of adding "start --verbose" to application arguments.
我不知道此时我还能检查什么。应用程序无法启动,并且根据我所做的搜索,我看不到日志输出。
任何帮助将不胜感激。蒂亚!
【问题讨论】:
标签: azure azure-functions azure-cosmosdb-changefeed