Esporta (0) Stampa
Espandi tutto

Proprietà RoleEnvironment.CurrentRoleInstance

Gets a RoleInstance object that represents the role instance in which the code is currently running.

Spazio dei nomi: Microsoft.WindowsAzure.ServiceRuntime
Assembly: Microsoft.WindowsAzure.ServiceRuntime (in microsoft.windowsazure.serviceruntime.dll)

'Utilizzo
Dim value As RoleInstance

value = RoleEnvironment.CurrentRoleInstance

public static RoleInstance CurrentRoleInstance { get; }
/** @property */
public static RoleInstance get_CurrentRoleInstance ()

public static function get CurrentRoleInstance () : RoleInstance

Valore proprietà

An instance of RoleInstance.

A role is a component of an application that performs specific functionality, such as running a website or performing background tasks. A role instance is a running copy of the role in Windows Azure or the Windows Azure Compute Emulator. A role must have endpoints defined to communicate internally and externally. The following code example shows how to retrieve endpoint information for the current role instance:


var roleInstance = RoleEnvironment.CurrentRoleInstance; 
foreach (RoleInstanceEndpoint instanceEndpoint in roleInstance.InstanceEndpoints.Values) 
{  
   Trace.WriteLine("Instance endpoint address and port: " + instanceEndpoint.IPEndpoint, "Information");
   Trace.WriteLine("Protocol for the endpoint: " + , instanceEndpoint.Protocol, "Information");
}

Tutti i membri statici pubblici (Shared in Visual Basic) di questo tipo sono thread-safe. I membri di istanza non sono garantiti come thread-safe.

Piattaforme di sviluppo

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

Piattaforme di destinazione

Aggiunte alla community

Mostra:
© 2014 Microsoft