简体   繁体   English

Windows Azure - 辅助角色 - 检测环境

[英]Windows Azure - Worker role - detect environment

Anyone know of a way to determine if a worker role is running in the production or staging environment? 任何人都知道确定工作者角色是否在生产环境或登台环境中运行的方法?

My worker role sends out daily email summaries of activities but if I have code in staging the email gets duplicated because I have two workers running. 我的工作人员角色会发送每日活动的电子邮件摘要,但如果我在暂存中有代码,则电子邮件会重复,因为我有两名工作人员正在运行。

Thoughts? 思考?

RoleEnvironment static class is available to find out current deploymentId. RoleEnvironment静态类可用于查找当前的deploymentId。 Using current deploymentId you can query the Diagnostics Management API to find out the type of a deployment 0 or 1. I believe "0" is production and "1" is Staging. 使用当前的deploymentId,您可以查询诊断管理API以找出部署0或1的类型。我认为“0”是生产,“1”是暂存。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM