I am using TimerTrigger CRON job to schedule a task for 2 days, but the trigger doesn't seem to work. Following is the code which I tried,
public static void StartupJob([TimerTrigger("0 * * * * *", RunOnStartup = true)] TimerInfo timerInfo) //0 * * * * * added CRON job to run for every minute for testing purpose
{
Console.WriteLine("Timer job fired!");
}
local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}
As the above code wasn't working I have added the following to the main()
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(config);
// The following code ensures that the WebJob will be running continuously
host.RunAndBlock();
}
Getting the following error and showing fix as to install DocumentFormat package, but installing this package isn't resolving the FunctionName error.
I'm a newbie to C# and unable to find what is the issue here. Any help or reference to good examples would be helpful and appreciated.
Thank you.