简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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