天青:如何执行启动任务在webrole每个站点条目? [英] Azure: How to execute startup tasks for each site entry at webrole?

查看:185
本文介绍了天青:如何执行启动任务在webrole每个站点条目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有WebRole,即多个站点。我们与一些网站的具体行动,每一个现场制作启动任务。的问题是,只有第一站点(在部分中列出的第一个网站),启动任务可能部署期间运行。

We have WebRole, that hosting multiple sites. We made startup tasks for each site with some site specific actions. The problem is that only startup task of first site (first site listed in section), could be run during deployment.

看起来这种情况会导致只有第一个站点(或从网络的作用defifnition一个)将被复制到[驱动器]:在WebRole实例\\文件夹为approot。所有其他网站将被复制到[驱动器]:\\网站\\(早期是其他位置,因此它可能是未来变化的主题)

Looks like this happens cause only first site (or that one from web-role defifnition) will be copied to [drive]:\approot folder at WebRole Instance. All other sites will be copied to [drive]:\sites\ (early it was another location so it could be a subject of future changes).

有没有简单的方法来运行在[硬盘]每个站点批处理文件:\\网站\\?

Is there any simple way to run batch files for each site in [drive]:\sites\ ?

是否与RoleEnvironment对象或XPath值什么花招(如这里 HTTP :?//msdn.microsoft.com/en-us/library/windowsazure/hh404006.aspx ),可以提供准确的路径在哪里其他网站将放在

Is there any tricks with RoleEnvironment object or xPath values (like here http://msdn.microsoft.com/en-us/library/windowsazure/hh404006.aspx) that can provide exact path where additional sites will be placed ?

ATM,我们有2个选项,都是哈克和不稳定的,IMO:
从IIS配置1.Read数据,并把它作为主要的启动任务输入
2.Scan /网站/为明确指定脚本,如果发现执行它。

ATM we have 2 options, both are hacky and unstable, imo: 1.Read data from IIS configuration and use it as main startup task input 2.Scan /sites/ for explicitly named scripts and execute it if found.

推荐答案

启动任务,就是要为角色而不是一个网站。你必须找到你的出路使用 RoleEntryPoint 后裔,并利用其<一个href=\"http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleentrypoint.onstart.aspx\"相对=nofollow>的OnStart 方法来手动运行每个站点的启动任务。

Startup Task is meant to be for a Role and not for a site. You have to find your way out using the RoleEntryPoint descendant and utilize its OnStart method to manually run your startup tasks per site.

至于找出网站目录检查<一href=\"http://stackoverflow.com/questions/4345508/how-can-i-get-the-webrole-site-root-path-from-roleentrypoint-onstart\">this问题,作为答案完全地覆盖任务。我使用它,它是生产可靠的100%。

As for finding out the sites directories check out this question, as the answer completly covers the task. I use it, it is 100% reliable for production.

这篇关于天青:如何执行启动任务在webrole每个站点条目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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