连续WebJob自动停止 [英] continuous WebJob stops automatically

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

问题描述

我有被配置为连续运行网站相关的Webjob和它是所有手表队列的消息并进行处理。

I have an Webjob associated with the Website that is configured to run continuously and all it does is watches a queue for a message and process it.

我的网站是在共享模式,几乎没有在,所以我已经设置了请求主页每隔1分钟,以保持网站被关闭,因为这测试的一部分虚拟服务的那一刻任何流量,而接缝按预期工作,我可以看到该网站本身并不关机。然而,这webjob保持关闭,大约一个小时,除非我去Azure管理门户网站,并查找webjob状态。那一刻我去那里再次启动,然后在几分钟内关闭一个小时。

My website is in a shared mode and hardly has any traffic at the moment so I have set up dummy service that is requesting the home page every 1 min to keep the website from being shut down as part of this testing, and that seams to work as expected and I can notice that website itself is not shutdown. however this webjob keeps shutting down in about an hour unless I go to the Azure Management portal and look for the webjob status. Moment I go there it starts up again and then shuts down in few minutes to an hour.

此webjob日志文件显示是这样的:

the log file for this webjob shows something like this:

[02/13/2015 09:19:45 > 4660f6: INFO] Job host started
[02/13/2015 10:19:41 > 4660f6: SYS INFO] WebJob is still running
[02/13/2015 10:20:35 > 4660f6: SYS INFO] WebJob is stopping due to website shutting down
[02/13/2015 10:20:35 > 4660f6: SYS INFO] Status changed to Stopping
[02/13/2015 10:20:35 > 4660f6: INFO] Job host stopped
[02/13/2015 10:20:35 > 4660f6: SYS INFO] Status changed to Success
[02/13/2015 10:20:35 > 4660f6: SYS INFO] Status changed to Stopped

我可以看到我的网站仍在运行和返回我的主页,但作业本身被停止。

I can see that my website is still running and returning me the home page, but job itself is stopped.

现在,当我登录到管理门户来寻找状态,我可以在日志中看到这一点:

now when i log in to the management portal to look for the status I can see this in the logs:

[02/13/2015 10:20:35 > 4660f6: SYS INFO] Status changed to Success
[02/13/2015 10:20:35 > 4660f6: SYS INFO] Status changed to Stopped
[02/13/2015 14:56:15 > 4660f6: SYS INFO] Status changed to Starting
[02/13/2015 14:56:17 > 4660f6: SYS INFO] Run script 'WebJobs.exe' with script host - 'WindowsScriptHost'
[02/13/2015 14:56:17 > 4660f6: SYS INFO] Status changed to Running
[02/13/2015 14:56:19 > 4660f6: INFO] Found the following functions:
[02/13/2015 14:56:19 > 4660f6: INFO] WebJobs.NotificationsProgram.ProcessQueueMessage
[02/13/2015 14:56:19 > 4660f6: INFO] WebJobs.NotificationsProgram.PublishNotification
[02/13/2015 14:56:19 > 4660f6: INFO] WebJobs.NotificationsProgram.ProcessMessages
[02/13/2015 14:56:19 > 4660f6: INFO] Job host started

任何想法,我怎么能确保该Webjob是活动的,只要该网站是活跃的?或者至少使该网站开始webjob以及当谈到回到运行状态。

Any ideas as to how can I make sure that the Webjob is active as long as the website is active? or at least to make that the website starts the webjob as well when it comes back to the running state.

更新1

我webjob本身就是如下一个非常简单的:

My webjob itself is a very simple one as shown below:

static void Main(string[] args)
{
    JobHost host = new JobHost();
    host.RunAndBlock();
}

和触发功能看起来接近这样的:

and the trigger functions looks close to like this:

public static void WriteLogPOCO([QueueTrigger("logqueue")] BlobInformation blobInfo, TextWriter logger)
{
    logger.WriteLine("Queue message refers to blob: " + blobInfo.BlobName);
}

是不是我要在这里做,表明这项工作应遵循网站的生命周期,即每一个网站启动时启动。

is there something I have to do here to indicate that this job should follow the lifecycle of the website, i.e. start up every time the website is started.

更新2

我想看看在Process Explorer中,我看到的三种情况之一时,WebJobs停止。我不知道怎么看作业日志而不去管理门户,所以不知道在这一点上的实际记录时间。

I tried to look at the Process Explorer and I see one of the three things when the WebJobs are stopped. I don't know how to see the job logs without going to the Management portal, so don't know the actual logs at this point in time.



但我敢肯定,作业没有运行其不会从处理队列中的任何消息,直到我去管理门户。

But I am sure that the Job is not running as its not processing any messages from the queue till I go to the management portal.

如下所示其中Pingdom的结果表明,该网站本身没有任何断点运行:

the pingdom result as shown below which shows that the website itself is running without any break:

问候
基兰

推荐答案

这样的行为,如果你因为你是要去的共享的是运行模式的预期。建议您打开始终打开如果你有一个连续运行webjob。然而,这是一个特点的基本的和的标准的,所以你需要改变你的模式或重新考虑你的解决方案。

This kind of behavior is expected if you're going to be running in Shared mode as you are. It is recommended that you turn on Always On if you have a continuously running webjob. However, this is a feature of Basic and Standard so you will need to change your mode or rethink your solution.

此外,要知道从此链接<使这些笔记/ A>

Also, be aware of these notes made from this link.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆