c# - How to automatically start Azure WebJob with TimeTrigger after recycle/restart WebApp -
i using webjob in azure webapp. job executes method:
public static void processqueue( [timertrigger("00:02:00")] timerinfo timerinfo, [queue("queue")] cloudqueue queue, [table("processing")] cloudtable processingtable, textwriter log) { // sth... }
the timetrigger
option came microsoft.azure.webjobs.extensions.
i set webapp run in "always on" mode.
but if doing restart or change application setting webapp possibly, internally make recycle? think.
because after getting following error:
[11/10/2016 08:22:24 > 36d12e: sys err ] webjob run failed due to: system.threading.threadabortexception: thread being aborted. @ kudu.core.jobs.basejobrunner.runjobinstance(jobbase job, ijoblogger logger, string runid, string trigger, itracer tracer, int32 port) @ kudu.core.jobs.triggeredjobrunner.<>c__displayclass10_1.b__0(object _)
so tried set schedule on webjob , tried paste cron schedule in directory nothing helped out bring job "running" after reset/recycle.
update 1
content of exe (main()
)
jobhostconfiguration config = new jobhostconfiguration(); config.tracing.consolelevel = tracelevel.verbose; config.queues.maxdequeuecount = 10; config.usecore(); config.usetimers(); var host = new jobhost(config); host.runandblock();
update 2
if deploy continous manually in azure portal running expected (thanks mathewc). manually step ;). in devops scenario build, created , deployed visual studio team services , there cannot set option deploy job continous.
based on call stack you've shown, looks may have incorrectly deployed job triggered rather continuous webjob? when using webjobs sdk, should deploy webjobs continuous described here.
once running in continuous mode, correct if change app setting or otherwise cause restart, webjobs restart. internal scheduler timertrigger ensure job continues run on schedule when comes up.
Comments
Post a Comment