自动更新启动任务是否可以在Azure应用程序中工作? [英] Will Autoupdate Startup task work in azure application?
问题描述
我已经为Azure应用程序构建了一个包含exe文件的启动任务(以一定的时间间隔定期运行),现在我想按照我在
I have built one startup task for Azure application contain exe file(running periodically with some time interval) and now i would like to make it autoupdating at every week as i have asked before here
但是,我将执行一些通过该exe(启动任务)替换该文件的逻辑,然后它也不会对新文件产生任何影响.我得出的结论是,仅当我们使用新文件升级/创建了该Azure项目时,新的启动任务才会生效. (如果我理解有误,请纠正我)
However i'll do some logic of replacing that file through that exe(startup task) then also it is not going to take any effect of new file. I have concluded that new startup task will take effect only if we upgrade/created that azure project with new file. (Correct me if i understood something wrong)
那么,有什么方法可以通过重启实例(通过exe/startuptask)来使我的逻辑正常工作吗? 我认为它也将使用原始文件(在升级/创建应用程序时添加到启动任务中)而不是新文件!
So is there any way to do my logic works by rebooting instance (by exe/startuptask) ? I think it will also take original file(added in startuptask at the time of upgrading/creating application) instead of new file!
反正有可能吗?
推荐答案
研究完您的问题后,我可以提出一个非常简单的解决方案,如下所示,这是我之前为Tomcat/Java示例所做的:
After I studied your problem i can propose a very simple solution as below which I have done before for a Tomcat/Java Sample:
准备您的EXE以重新启动VM以及原始代码:
- 在您的EXE中,创建一种方法以按一定的时间间隔在Azure存储上查找特定的XML文件,并添加重试逻辑以访问XML
- 解析XML以获取特定值,如果设置了特定值,则重新启动计算机
- 以ZIP格式打包EXE并将其放置在Azure存储中
- 确保将XML放在云上并设置reboot = false值
启动任务中的操作:
- 创建启动任务并从包含您的EXE的Azure存储中下载ZIP
- 下载后,解压缩文件并将EXE放置到特定文件夹
- 启动EXE
要更新EXE时的操作:
- 更新您的EXE,打包为ZIP并以相同的名称放置在Azure存储中的相同位置
- 更新您的XML以启用重新启动
如何进行更新:
- EXE将按设计的某些内部条件查找XML
- 一旦看到设置了重新启动",它将重新启动虚拟机
- 重新启动后,启动任务将启动,新的EXE将下载到Azure VM并进行更新.确保下载和更新在同一文件夹中完成.
在下面的示例中使用类似的方法查看Startup tak: http://tomcatazure.codeplex.com/
Take a look at Startup tak in the sample below which use similar method: http://tomcatazure.codeplex.com/
这篇关于自动更新启动任务是否可以在Azure应用程序中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!