Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以从部署到 Web 角色加速器上的站点获取有关 Web 角色的信息?例如,我想获取正在使用的实例名称:
RoleEnvironment.CurrentRoleInstance
是的。
在幕后,Web 角色加速器并没有什么特别之处——它实际上只是一种将其他站点发布到已经部署的 Web 角色的快速方法。
RoleEnvironment.CurrentRoleInstance是一个可以从任何应用程序调用的静态属性,如果RoleEnvironment.IsAvailable是这样,您应该会收到您期望的值。
RoleEnvironment.IsAvailable