匯出 (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