【发布时间】:2016-04-23 11:41:18
【问题描述】:
所以我尝试在 Azure WebJobs SDK 中使用 Timer Trigger,但它似乎正在触发。
这是我的主要方法
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。
我还有另一种方法可以从调用正常的队列中运行。知道我在这里做错了什么吗?
【问题讨论】:
-
@Nitin 谢谢,我不知道开发设置。仍然是同样的问题,但它应该证明是有用的
标签: c# azure azure-webjobs