通过 Microsoft.WindowsAzure.ServiceRuntime 检测 Azure Stage 或 Production

发布于 2025-01-07 01:35:45 字数 531 浏览 1 评论 0原文

我知道这个问题之前已经被问过,比如 这个。但它们都很老了,方法也很复杂,我试过也不能真正起作用。所以我想知道新的 Azure SDK 是否提供了一些简单的东西,我想应该来自 Microsoft.WindowsAzure.ServiceRuntime 命名空间。

我需要这个,因为我使用一个工作者角色来挂载 CloudDrive,不断检查它并共享到网络,然后在其上构建 lucene.net。

这种部署效果非常好。

由于只有 1 个实例可以挂载 CloudDrive,因此当我进行 VIP 交换时,我必须停止/(或删除)阶段部署,然后新的生产部署才能成功挂载驱动器。这会导致全文搜索停止一段时间(如果一切顺利并且我单击按钮的速度足够快,则大约 1-2 分钟)。所以我想知道是否可以检测当前状态,并且仅在生产时安装并在阶段卸载。

I know this question has been asked before, like this one. But they all very old, the method is very complex and I tried cannot really get it work. So I wonder if the new Azure SDK gives something easy, I guess should from Microsoft.WindowsAzure.ServiceRuntime namespace.

I need this because I use a worker role that mount CloudDrive, keep checking it and share to the network, then build a lucene.net on it.

This deployment works very well.

Since only 1 instance can mount the CloudDrive, so when I do VIP swap, I have to stop/(or delete) the stage deployment, then the new production deployment can successfully mount the drive. This cause the fulltext search stop for awhile (around 1-2 minutes if everything well and I click the button fast enough). So I wonder if I can detect current status, and only mount when production and unmount when stage.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

醉殇 2025-01-14 01:35:45

我找到了解决此问题的一种方法,请在此处查看我的答案:

https://stackoverflow.com/a/18138700/1424115

I figured out one way to solve this, please see my answer here:

https://stackoverflow.com/a/18138700/1424115

椵侞 2025-01-14 01:35:45

这是一个更简单的解决方案。
我所做的是ip检查。登台环境获得与生产环境不同的外部 IP。生产ip地址是(yourapp).cloudapp.net的ip。所以你唯一需要做的就是检查这两者是否匹配。

Here a what more simpler solution.
What i did was an ip check. The staging enviroment gets a different external ip then the production enviroment. The production ip adres is the ip of (yourapp).cloudapp.net. So the only thing you need to do is to check if these two match.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文