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?
我的辅助角色发出的活动每日电子邮件摘要,但如果我有分期电子邮件code被复制,因为我有两个工人正在运行。
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.
的思考?
推荐答案
RoleEnvironment静态类可找出当前deploymentId。采用目前deploymentId可以查询诊断管理API找出0或1。我相信0部署的类型是生产和1正在上演。
RoleEnvironment static class is available to find out current 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.
希望这有助于。
这篇关于Windows Azure的 - 工作者的角色 - 检测环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!