(0) exportieren Drucken
Alle erweitern

RoleEnvironment.Roles-Eigenschaft

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

Namespace: Microsoft.WindowsAzure.ServiceRuntime
Assembly: Microsoft.WindowsAzure.ServiceRuntime (in microsoft.windowsazure.serviceruntime.dll)

'Usage
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>

Eigenschaftswert

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");
   }
}
noteHinweis
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.


Alle öffentlichen statischen (freigegebenen in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Entwicklungsplattformen

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Server 2008 und Windows 2000

Zielplattformen

Community-Beiträge

Anzeigen:
© 2014 Microsoft