如何检测Azure应用程序在开发面料跑? [英] How to detect that azure application is running in development fabric?

查看:154
本文介绍了如何检测Azure应用程序在开发面料跑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能可靠性检测面料的发展我的Azure应用程序是否正在运行,而不是在'云'?

How can I reliability detect whether my Azure application is running in development fabric and not in 'the cloud' ?

RoleEnvironment.IsAvailable是双方真实。我想要的东西,只有一个案件是真实的。

RoleEnvironment.IsAvailable is true for both. I want something that is true in only one case.

我问,是因为我希望我的图书馆用户能够使用我的图书馆免费的开发结构。因此,把手动配置文件中的单独标识或标志并保持两份CONFIGS用于开发和部署是不可行的。

I'm asking this because I want users of my library to be able to use my library for free in dev fabric. Hence manually putting separate identifier or flag in config file and keeping two configs for dev and deploy is not feasible.

推荐答案

一种选择是看看 RoleEnvironment.DeploymentId - 如果你在​​运行开发织物,它应该有像名'的部署(n)的'其中n为某个序列号。如果你在生产中运行,部署ID应该像一个GUID。

One option is to take a look at RoleEnvironment.DeploymentId - if you're running in the dev fabric, it should have a name like 'deployment(n)' where n is some sequential number. If you're running in production, the deployment id should resemble a Guid.

您可以做的另一件事是看一个角色的实例名称。在生产中,应在 _0结束(重presenting实例0)。在面料开发,它将在 .0

Another thing you can do is look at an role's instance name. In production, it should end in _0 (representing instance 0). In the dev fabric, it will end in .0

修改2013年1月8日 - 意识到这个答案我给了2年多前是相当落伍!现在,这里还有 RoleEnvironment.IsEmulated - 查看详情here.

EDIT 1/8/2013 - realized this answer I gave over 2 years ago is quite outdated! Now there's also RoleEnvironment.IsEmulated - check out the details here.

这篇关于如何检测Azure应用程序在开发面料跑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆