Forum Discussion
Srinivas Narula
Feb 16, 2017Brass Contributor
PnP Timerjob - Showing Failing status at azure webjob
Hi All, I have used PnPTimerjob Framework to sync data between two data sources in office365 suite. This job was published to azure webjob and configured to run on recurring basis. Though jo...
Kiril Iliev
Feb 17, 2017Brass Contributor
There is an automatic timeout for timer jobs. Depending on your settings and your code, the following could be the cause (not limited to those, but some bullets to check):
- For long running jobs, Azure web job will be termined prematurly. In that case, you should enable Always On (available from pricing Basic tier 1)
- For triggered jobs, you have to explicitly terminate your job, otherwise Azure will terminite it for you with a timeout exception - for example Environment.Exit(0), you can also register that the job failed by calling Environment.Exit(1)
Also, here is a more proper way of writing the code - that way it will call your function and then end, not run continously and register a timeout exception:
static void Main(string[] args)
{
JobHost host = new JobHost();
host.Call(typeof(Program).GetMethod("RunTask"));
}
[NoAutomaticTrigger]
public static void RunTask()
{
Console.WriteLine("Creating queue message: ", message);
}Srinivas Narula
Feb 21, 2017Brass Contributor
Kiril Iliev
Thanks. I did samething in my application. Looks like there is an issue with the timerjob related webapplication. I will check the same application in other tenant to confirm it.
Thanks. I did samething in my application. Looks like there is an issue with the timerjob related webapplication. I will check the same application in other tenant to confirm it.