Azure函数应用活动日志中神秘“List”错误的问询与排查
我在排查定时器未触发问题时,发现Function App活动日志中存在如下错误:
"No route registered for '/api/functions/HistoryCleanup/config/appsettings/list?api-version=2022-03-01'"
起初我以为这是定时器故障的原因,但日志显示定时器实际已正常运行。我想了解:
- 这些错误是什么?
- 为何看似由我发起?我并未主动发起此类请求,是否是Azure自动执行的?
- 是否可忽略该错误?
补充信息:
- 我已通过调用Azure管理API重现该错误,代码如下:
const string subId = "subscription_id_here"; const string rgName = "resoruce_group_name_here"; const string fnAppName = "function_app_name_here"; const string url = $"/subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Web/sites" + $"/{fnAppName}/functions/HistoryCleanup/config/appsettings" + "/list?api-version=2022-03-01"; var credentials = new DefaultAzureCredential(); AccessToken tokenResult = await credentials.GetTokenAsync(new TokenRequestContext([ "https://management.azure.com/.default" ]), CancellationToken.None); using var httpClient = new HttpClient(); httpClient.BaseAddress = new Uri("https://management.azure.com/subscriptions/"); httpClient.DefaultRequestHeaders.Remove("Authorization"); httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {tokenResult.Token}"); HttpResponseMessage response = await httpClient.PostAsync(url, null); string responseString = await response.Content.ReadAsStringAsync(); Console.WriteLine($"Response: {Environment.NewLine}{responseString}");
- 我的定时器函数代码:
[Function(nameof(HistoryCleanup))] [FixedDelayRetry(3, "00:05:00")] public async Task HistoryCleanup( [TimerTrigger("%CRON_HistoryCleanup%")] TimerInfo timer, [DurableClient] DurableTaskClient durableTaskClient, FunctionContext context) { // omitted... }
- 环境变量通过Bicep配置:
appSettings: [ // ... { name: 'CRON_HistoryCleanup' value: '0 5 0 1 * *' } // ... ]
- 该错误仅出现在2个定时器触发函数中,HTTP/持久函数无此问题,且可能在更新环境变量或重启应用时出现。
1. 错误本质
这个错误是因为请求的API端点不存在:Azure Functions管理API中没有针对单个函数的/functions/{functionName}/config/appsettings/list路由。正确的应用设置获取端点是针对整个Function App的/subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Web/sites/{fnAppName}/config/appsettings/list,而非单个函数级别。
2. 请求发起方
这些请求不是你主动发起的,而是Azure Functions运行时或Durable Functions扩展内部自动触发的。结合你的场景(仅定时器+Durable Client函数出现、更新配置/重启后触发),推测是函数初始化阶段,运行时在尝试加载函数特定配置时的错误调用——属于特定触发器与扩展组合的内部逻辑小问题,误将应用设置请求定位到了单个函数路径。
3. 是否可以忽略
完全可以忽略。从你的描述来看,定时器函数实际正常运行,说明这个错误只是运行时内部的无效请求,没有影响函数核心执行逻辑,不会导致定时器不触发、业务功能异常等问题,只是日志里的冗余报错。
额外提示
- 无需修改代码或配置来消除该错误,除非Azure官方发布相关修复更新。
- 该错误仅出现在定时器触发+Durable Client的组合场景中,进一步验证了是特定组件组合的内部逻辑问题。
内容的提问来源于stack exchange,提问作者Shahin Dohan

