计时器触发 Azure 函数未触发 [英] Timer triggered Azure Function not getting triggered

查看:37
本文介绍了计时器触发 Azure 函数未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Azure 上有一个带有以下 function.json 文件的函数:

I have a function on Azure with the follow function.json file:

{
    "bindings": [
        {
            "type": "timerTrigger",
            "direction": "in",
            "schedule": "0 0 3 * * *",
            "name": "myTimer"
        }
    ],
    "disabled": false
}

除非我错了,否则这应该让函数在每天凌晨 3 点运行一次?

Unless I'm wrong, this should make the function run once a day, at 3AM ?

这是函数的签名:

public static async Task Run(TimerInfo myTimer, TraceWriter log) {}

那么我做错了什么?该功能在我手动触发时运行良好(在门户中单击运行"),但它没有在今天凌晨 3 点运行,昨天也没有运行.

So what is it I'm doing wrong? The function works fine when I manually trigger it (clicking "Run" in the portal), but it didn't run at 3AM this morning, and it didn't yesterday either.

因此,按照建议,我已将计划更改为付费计划,并选择了动态计划.日志仍然没有说明该功能在今天凌晨 3 点被激活.

So, as suggested, I've changed the plan to a paid plan, and I've selected a dynamic plan. The logs still says nothing about the function getting activated at 3AM this morning.

推荐答案

在经典模式下运行的应用程序需要启用始终开启".仔细检查这是否已启用 - 这可以解释它.

Apps that run in Classic mode require 'Always On' to be enabled. Double-check that this is enabled -- that would explain it.

Functions 应用可以在两种计划中运行:DynamicClassic.您在应用程序创建期间选择计划.目前无法在应用创建后切换计划:

There are two plans that Functions apps can run in: Dynamic and Classic. You choose the plan during app creation. There's currently no way to switch plans after the app has been created:

  • 经典计划在应用服务计划上运行,就像其他应用服务应用一样.您可以从 Free、Basic、Standard 等中进行选择,并且您可以自己控制规模.如果您使用的是经典计划,则必须打开始终开启"才能使触发器可靠地触发.这要求您的站点处于基本或标准模式.您可以通过单击功能应用设置"->转到应用服务设置"从您的功能应用进行管理(并检查始终开启").始终开启"设置位于应用程序设置"中.

  • Classic Plans run on App Service plans just like other App Service apps. You can choose from Free, Basic, Standard, etc, and you control the scale yourself. If you are using a Classic Plan, you must turn on 'Always On' in order to have triggers fire reliably. This requires your site to be in Basic or Standard mode. You can manage this from your Function App (and check for 'Always On') by clicking 'Function app settings' -> 'Go to App Service Settings'. The 'Always On' setting lives in 'Application settings'.

动态计划按执行收费.没有始终开启"的概念 - 当触发器触发时,您的网站将启动(如果尚未启动)并且您的函数将运行.

Dynamic Plans are charged by execution. There's no concept of 'Always On' -- when a trigger fires, your site will be started (if it's not already) and your function will run.

有关详细信息,请参见此处:https://azure.microsoft.com/en-us/documentation/articles/functions-scale/#choose-a-service-plan

See here for more details: https://azure.microsoft.com/en-us/documentation/articles/functions-scale/#choose-a-service-plan

这篇关于计时器触发 Azure 函数未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆