Azure Web 作业计时器触发器未触发

Azure Web Job Timer trigger not firing

我是 azure web 作业的新手。我正在使用版本 2.0.0 的 azure 扩展和核心。我正在使用 this git repo,据我所知,它使用的是 nigets 的测试版。目前,我正在 运行 在我的本地计算机上以调试模式设置应用程序。我使用 TimerTrigger 创建了一个每分钟 运行 的函数。代码如下,

static void Main()
    {
        var config = new JobHostConfiguration();
        config.UseTimers();
        config.Tracing.ConsoleLevel = System.Diagnostics.TraceLevel.Verbose;

        if (config.IsDevelopment)
        {
            config.UseDevelopmentSettings();
        }

        var host = new JobHost();
        // The following code ensures that the WebJob will be running continuously
        host.RunAndBlock();
    }
   [NoAutomaticTrigger]
   public static void TimerTrig([TimerTrigger("0 * * * * *", RunOnStartup = true)] TimerInfo timer)
        {
            Console.WriteLine("Triggered");
        }

我的问题是, - None 我在网上看到的示例使用 [NoAutomaticTrigger] 属性。但如果我不使用它,作业主机将无法找到该功能本身。 - 该功能未触发。我在 cron 符号中使用了设置时间,运行 start up = true,使跟踪控制台级别变得冗长。

我错过了什么?

尝试将您的配置作为参数传递给作业宿主构造函数。

var host = new JobHost(config);

因为 google 将此作为对定时器触发器为何未触发的第一反应...

如果您已将项目创建为 Azure Web 作业类型,Visual Studio 会生成函数 class。如果 class 存在,则 Azure 将仅从 class.

加载 TimerTrigger 和服务总线函数

没有它,Azure 将识别来自其​​他位置的函数。