Windows Azure - Worker role - detect environment

一个人想着一个人 提交于 2019-12-23 12:57:23

问题


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?


回答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.

Hope this helps.



来源:https://stackoverflow.com/questions/4672885/windows-azure-worker-role-detect-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!