如何成功退出 Azure Web 作业?
How to successfully exit an Azure Web Job?
我有一个 Azure Web 作业,目前函数本身总是会成功完成。但是作业本身失败并出现此错误:
[11/26/2016 07:12:11 > 462baa: ERR ] Command 'cmd /c ""MyJob.Webjob ...' was aborted due to no output nor CPU activity for 121 seconds. You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting (or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed.
cmd /c ""MyJob.Webjob.StuffJob.exe""
[11/26/2016 07:12:11 > 462baa: SYS INFO] Status changed to Failed
我的功能完成后我该怎么做才能让工作知道它已完成,而不是闲置和超时?
这是我的函数的 class 方法。一切正常,但没有正确停止,我不知道如何告诉我完成后的工作。
[NoAutomaticTrigger()]
public void ProcessLoanOriginationDocuments(TextWriter log)
{
try
{
log.WriteLine("Starting Job");
_service.DoSomething();
log.WriteLine("Ending Job");
}
catch (Exception ex)
{
log.WriteLine(ex.Message);
}
}
What can I do once my function is complete to let the job know it's done instead of sitting idle and timing out?
根据我的经验,我们需要将 WEBJOBS_IDLE_TIMEOUT 值设置得足够大才能让 WebJob 完全执行。
根据您的描述,azure WebJob 停止可能是网站闲置造成的。请尝试通过以下方式进行故障排除:
- 设置网站“永远在线”
"Always On" is not supported if WebApp is in a free Service Plan tier. If the WebApp is in a free tier, please scale up the App Service Plan. Please refer to the document for more info about how to scale up the App Service Plan.
- 在 Azure 门户中添加 WEBJOBS_IDLE_TIMEOUT。有关 WebApp 设置的更多信息,请参阅 document。
- 如果以上方法还不能解决,请尝试继续写到控制台以保留WebJob 运行。
我有一个 Azure Web 作业,目前函数本身总是会成功完成。但是作业本身失败并出现此错误:
[11/26/2016 07:12:11 > 462baa: ERR ] Command 'cmd /c ""MyJob.Webjob ...' was aborted due to no output nor CPU activity for 121 seconds. You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting (or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed.
cmd /c ""MyJob.Webjob.StuffJob.exe""
[11/26/2016 07:12:11 > 462baa: SYS INFO] Status changed to Failed
我的功能完成后我该怎么做才能让工作知道它已完成,而不是闲置和超时?
这是我的函数的 class 方法。一切正常,但没有正确停止,我不知道如何告诉我完成后的工作。
[NoAutomaticTrigger()]
public void ProcessLoanOriginationDocuments(TextWriter log)
{
try
{
log.WriteLine("Starting Job");
_service.DoSomething();
log.WriteLine("Ending Job");
}
catch (Exception ex)
{
log.WriteLine(ex.Message);
}
}
What can I do once my function is complete to let the job know it's done instead of sitting idle and timing out?
根据我的经验,我们需要将 WEBJOBS_IDLE_TIMEOUT 值设置得足够大才能让 WebJob 完全执行。
根据您的描述,azure WebJob 停止可能是网站闲置造成的。请尝试通过以下方式进行故障排除:
- 设置网站“永远在线”
"Always On" is not supported if WebApp is in a free Service Plan tier. If the WebApp is in a free tier, please scale up the App Service Plan. Please refer to the document for more info about how to scale up the App Service Plan.
- 在 Azure 门户中添加 WEBJOBS_IDLE_TIMEOUT。有关 WebApp 设置的更多信息,请参阅 document。
- 如果以上方法还不能解决,请尝试继续写到控制台以保留WebJob 运行。