本文介绍了Azure WebJob自动中止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用.NET C#开发的WebJob项目,我通过Visual Studio 2015在Azure上部署了该WebJob.CRON "0 0 7 1 * *" (在每个月的第一天上午7点运行)在settings.job文件上.部署并运行后,在日志上保持每30秒收到一次单例锁定消息:

 "[[11/02/2016 20:29:52> 21cce2:INFO]更新单例锁....." 

所以一切看起来都不错,但是几个小时后,Webjob会在Azure门户上自动中止,而无需对Web应用程序或Webjob本身进行任何更改.

可能是什么原因,如何使用C#避免这种情况?

解决方案

这是否意味着在Azure门户中已打开始终在线?默认情况下,它是关闭的.如果我们不始终打开将其打开,则WebJob可能会在闲置一段时间后中止运行.如果Web应用程序闲置了一段时间,则将其卸载.这样可以节省系统资源.请尝试设置始终开启"以始终保持应用程序加载.更多,请参阅屏幕截图.

如果打开始终在线,并且始终使WebJob中止,请尝试安装崩溃诊断程序"以捕获崩溃的信息.有关崩溃诊断程序的更多信息,请参考

I have a a WebJob project developed in .NET C#, which I deploy on Azure through Visual Studio 2015. The WebJob is scheduled with CRON "0 0 7 1 * *" (to run at 1st day of the every month at 7am) on the settings.job file. After it is deployed and running, on the log keep getting the singleton lock message every 30 seconds:

"[11/02/2016 20:29:52 > 21cce2: INFO] Renewing Singleton lock....."

So everything looks good, but after couple of hours the webjob gets automatically aborted on Azure Portal, without doing any changes to the web app or the webjob itself.

What can be the reason and how can I avoid this with C# ?

解决方案

Does it mean that Always On is turned on in Azure Portal? By default, it is turned off. If we don’t turn it Always On, WebJob may abort in idle for some period of time. Web apps are unloaded if they are idle for some period of time. This lets the system conserve resources. Please have a try to set Always On to keep the app loaded all the time. More please refer to the screenshot.

If the Always On is turned on, and always get the WebJob aborted ,please have a try to install Crash Diagnoser to catch crashed info. More info about Crash Diagnoser,please refer to link.

这篇关于Azure WebJob自动中止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 12:24