gpt4 book ai didi

.net - 如何以编程方式获取云服务的事件实例名称?

转载 作者:行者123 更新时间:2023-12-02 21:10:04 25 4
gpt4 key购买 nike

希望有人知道用于获取给定 Azure 云服务中事件(正在运行的实例)名称的特定 .Net 库(或者如果不知道,则了解 REST 服务)。

enter image description here

最佳答案

使用 .NET 代码中的“RoleEnvironment.CurrentRoleInstance.Id”。确保此代码有权访问 ServiceRuntime DLL(通常仅由您的 WebRole 或 WorkerRole 项目引用)。此调用在本地模式、非模拟代码中也会失败,因此 try/catch 可能是一个好主意

编辑:要获取角色中的所有实例,请尝试此操作?RoleEnvironment.CurrentRoleInstance.Role.Instances

关于.net - 如何以编程方式获取云服务的事件实例名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34010533/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com