3
votes

So im trying to use the Timer Trigger in the Azure WebJobs SDK but it dosent appear to be triggering.

This is my Main method

var config = new JobHostConfiguration();
config.UseTimers();

JobHost host = new JobHost(config);
host.RunAndBlock();

And this is my method

[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")
}

It works fine if I invoke it manually so there's nothing wrong with the code in the method. I've also tried to use other times, eg 00:01:00.
I also have another method that runs off a queue which invokes fine. Any idea what I'm doing wrong here?

1
@Nitin Thanks, I didn't know about the development settings. Still the same problem but it should prove usefulToxicable

1 Answers

1
votes

You need to remove the [NoAutomaticTrigger] attribute.

If you decorate a function with this attribute, the JobHost will not index your function to be triggered.