Exportar (0) Imprimir
Expandir todo

RoleEnvironment.Roles (Propiedad)

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

Espacio de nombres: Microsoft.WindowsAzure.ServiceRuntime
Ensamblado: Microsoft.WindowsAzure.ServiceRuntime (en microsoft.windowsazure.serviceruntime.dll)

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

Valor de propiedad

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


Cualquier miembro estático público (Shared en Visual Basic) de este tipo es seguro para subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Plataformas de desarrollo

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

Plataformas de destino

Adiciones de comunidad

Mostrar:
© 2014 Microsoft