CRON Scheduled WebJob 突然退出被调用

CRON Scheduled WebJob abruptly quit being called

我通过 Settings.job '0 0/10 * * *' 安排了一个 WebJob 每 10 分钟 运行 一次,一直工作正常,然后昨晚我的工作就停止了。在 eventlog.xml 中环顾最后一次通话,我看到以下内容

<EventData>
            <Data>7192</Data>
            <Data>LogCleanup</Data>
            <Data>Role environment . FAILED TO INITIALIZE. hr: -2147024891</Data>
 </EventData>

此后不再调用,我今天早上从门户手动 运行 作业,它工作正常,并且按预期每 10 分钟再次调用一次。我的 NLog 内部日志文件记录了最后一个 运行 被调用

的以下内容
2016-12-15 21:40:02.6449 Error Error has been raised. Exception: Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (409) Conflict. ---> System.Net.WebException: The remote server returned an error: (409) Conflict.
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   --- End of inner exception stack trace ---
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Table.CloudTable.Execute(TableOperation operation, TableRequestOptions requestOptions, OperationContext operationContext)
   at NLog.AzureTableStorage.AzureTableStorageTarget.Write(LogEventInfo logEvent)
   at NLog.Targets.Target.Write(AsyncLogEventInfo logEvent)
Request Information
RequestID:1153c4ed-0002-000e-611b-57d353000000
RequestDate:Thu, 15 Dec 2016 21:40:02 GMT
StatusMessage:Conflict
ErrorCode:EntityAlreadyExists

这些错误对我来说没有任何意义,但更大的问题是为什么这项工作只是停止被调用?一个 运行 因某些无法解释的错误而失败,调度程序停止调用它似乎不正确。

WebJobs 的可靠性如何? 我需要进行什么样的检查来验证它们是否被调用?

请确保您的 Web 应用程序启用了 AlwaysOn。 CRON 计划作业需要这个 - 请参阅文档 here。如果我们检测到您没有启用 AlwaysOn,运行时实际上会向日志发出警告:

Always On' doesn't appear to be enabled for this Web App. To ensure your continuous job doesn't stop running when the SCM host is idle for too long, consider enabling 'Always On' in the configuration settings for your Web App. Note: 'Always On' is available only in Basic, Standard and Premium modes.

请检查您的 WebJob logs - 您应该会看到它。该日志的想法是帮助用户自动诊断此问题,但也许您没有看到它?如果我们检测到您有连续的 WebJobs 但未启用 AlwaysOn,我们还会在 WebJob 的门户中显示警告。此警告将通过 WebApp 设置页面上的 AlwaysOn 设置显示。