导出 (0) 打印
全部展开

RoleEnvironment.Roles 属性

Gets the set of Role objects defined for the hosted service.

命名空间: Microsoft.WindowsAzure.ServiceRuntime
程序集: Microsoft.WindowsAzure.ServiceRuntime(在 microsoft.windowsazure.serviceruntime.dll 中)

用法
Dim value As IDictionary(Of String, Role)

value = RoleEnvironment.Roles

public static IDictionary<string,Role> Roles { get; }
/** @property */
public static IDictionary<String,Role> get_Roles ()

public static function get Roles () : IDictionary<String,Role>

属性值

A IDictionary that contains the Role objects that are defined for the hosted service.

Roles are defined in the ServiceDefinition.csdef file. For more information about defining roles for a hosted service, see Setting Up a Hosted Service for Windows Azure.

The following code example shows how to obtain the role instance IDs for defined roles:


foreach (var roleDefinition in RoleEnvironment.Roles) 
{ 
   foreach (var roleInstance in roleDefinition.Value.Instances) 
   { 
      Trace.WriteLine("Role instance ID: " + roleInstance.Id, "Information");
   }
}
note说明
At least one internal endpoint must be defined for a role to enable instances to be known at runtime. For more information about defining internal endpoints, see How to Define Internal Endpoints for a Role.


此类型的任何公共静态(在 Visual Basic 中为 Shared)成员都是线程安全的。但不保证所有实例成员都是线程安全的。

开发平台

Windows XP Home Edition, Windows XP Professional, Windows Server 2003、Windows Server 2008 和 Windows 2000

目标平台

社区附加资源

显示:
© 2014 Microsoft