2016-12-02 135 views
0

我有一个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 

我能做些什么,一旦我的功能齐全,让工作知道这是做,而不是闲置和超时?

这是我函数的类方法。一切都运行良好,但它不能正常停止,当我完成时我不知道如何告诉工作。

[NoAutomaticTrigger()] 
     public void ProcessLoanOriginationDocuments(TextWriter log) 
     { 
      try 
      { 
       log.WriteLine("Starting Job"); 
       _service.DoSomething(); 
       log.WriteLine("Ending Job"); 
      } 
      catch (Exception ex) 
      { 
       log.WriteLine(ex.Message); 
      } 
     } 
+0

我的印象是,你不需要做任何特别的事情,你可以分享代码吗? – 4c74356b41

+0

你是否检查过此链接http://stackoverflow.com/questions/25489467/azure-webjob-command-timeout?rq=1 –

回答

0

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被完全执行。

从您的描述中,蔚蓝的WebJob停止可能是由闲置的网站引起的。请试用解决如下的方式:“永远在线”

  1. 设置网站

    "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.

enter image description here

  • 添加WEBJOBS_IDLE_TIMEOUT在Azure门户。有关WebApp设置的更多信息,请参阅document
  • enter image description here

  • 如果没有上面的方法解决,请试试看保持写出到控制台,以保持WebJob运行。