Azure Webjob TimerTrigger不起作用
问题描述:
所以即时尝试使用Azure WebJobs SDK中的计时器触发器,但它的剂量似乎是触发。Azure Webjob TimerTrigger不起作用
这是我的主要方法
var config = new JobHostConfiguration();
config.UseTimers();
JobHost host = new JobHost(config);
host.RunAndBlock();
这是我的方法
[NoAutomaticTrigger]
public static void GetNextMaint([TimerTrigger("00:00:01", RunOnStartup = true)] TimerInfo info, TextWriter log)
{
log.WriteLine("Getting info from url")
var info = WebsiteHelper.GetInfoFromWebsite(..website...);
var db = new ApplicationDbContext();
db.Info.Add(new Info{ text = info});
db.SaveChanges();
log.WriteLine("Complete, shutting down")
}
如果我手动调用它,所以没有什么错在方法中的代码,它工作正常。我也尝试过使用其他时间,例如00:01:00
。
我也有另一种方法,运行罚款调用的队列。任何想法我在这里做错了吗?
答
您需要删除[NoAutomaticTrigger]
属性。
如果你用这个属性装饰一个函数,JobHost
将不会索引你的函数被触发。
+0
哦......这是有道理的感谢。我刚才在那里提到'JobHost'没有看到我的函数 – Toxicable
可能会有助于http://*.com/questions/34665763/azure-webjobs-timertrigger-not-triggering – Nitin
@Nitin谢谢,我不知道有关开发设置。仍然是同样的问题,但它应该证明有用 – Toxicable