通过 WAPPS Cmdlet 了解 Azure 部署何时准备就绪
使用 WAPPS Cmdlet,我尝试以编程方式找出服务部署后何时可以使用该服务。我的 Powershell 脚本在部署过程中执行的最后一个操作:
$hostedService |获取部署-插槽暂存|设置部署状态 - 运行状态|获取操作状态 -WaitToComplete
它工作正常,但实际上在此之后部署尚未准备好使用。看来具体的事例还得开始。我需要等待不超过 4 或 5 分钟才能通过浏览器访问 webrole。 我如何知道服务准备就绪的时间? 我想到了轮询机制,但无法通过 WAPPS Cmdlet 实现它。要么我很愚蠢,要么我没有获得有关函数返回值的 Cmdlet 文档。我找不到返回实例状态等的函数。 GetRoleInstanceStatus 听起来不错,但恕我直言,它对我的担忧毫无用处?
谢谢!
Using WAPPS Cmdlets, I'm trying to find out programmatically the moment I can use a service after it was deployed. The last action my Powershell script does in the deployment process:
$hostedService | Get-Deployment -Slot Staging | Set-DeploymentStatus
-Status Running | Get-OperationStatus -WaitToComplete
It works fine, but in fact the deployment is not ready to use after this point. It seems that concrete instances still have to start. No more than 4 or 5 minutes I have to wait until the webrole is accessible via browser.
How can I find out the moment the service is ready?
I thought of a polling mechanism, but I'm not able to realize it via the WAPPS Cmdlets. Either I'm stupid or I don't get the documentation of the Cmdlets concerning return values of functions. I can't find a function that returns, among other things, the status of instances. GetRoleInstanceStatus sounds nice, but imho it's useless for my concern?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有直接的方法可以从 Powershell cmdlet 判断服务何时可供使用,因为您需要等待操作系统完成启动、IIS 初始化以及服务填充它使用的任何本地缓存。
可能的选项可能包括:
轮询服务上的“状态”操作,如下所述:如何查明 Azure 服务是否正在运行
WebRole.cs
OnStart
方法中调用服务,然后写入(例如)表存储,或者在服务可用时通过 Azure 服务总线通知通知感兴趣的各方There isn't a direct way to tell from the Powershell cmdlets when the service is ready for use, as you need to wait for the operating system to finish starting, IIS to initialize, and your service to populate any local cache it uses.
Possible options might include:
Polling a "status" operation on the service, as outlined here: How to find out if Azure service is running
Something in the
WebRole.cs
OnStart
method that calls the service, then writes out to (say) table storage or notifies interested parties through an Azure Service Bus notification when the service is available