Partilhar via


RoleInstance.Id Property

 

Gets the instance identifier (ID) of the role instance.

Namespace:   Microsoft.WindowsAzure.ServiceRuntime
Assembly:  Microsoft.WindowsAzure.ServiceRuntime (in Microsoft.WindowsAzure.ServiceRuntime.dll)

Syntax

public abstract string Id { get; internal set; }
public:
property String^ Id {
    virtual String^ get() abstract;
    internal: virtual void set(String^ value) abstract;
}
abstract Id : string with get, internal set
Public MustOverride Property Id As String
    Get
    Friend Set
End Property

Property Value

Type: System.String

Type: System.String

A String that contains the instance ID for the role instance.

Remarks

The following code example shows how to retrieve the instance ID for role instances:

foreach (var role in RoleEnvironment.Roles) 
{
   foreach (var roleInstance in role.Value.Instances)      
   {
      Trace.WriteLine("Role instance ID: " + roleInstance.Id, "Information");
   }
}

The instance ID is unique to the application. If a role instance is stopped and has been configured to restart automatically, the restarted role instance will have the same instance ID as the stopped role instance.

See Also

RoleEnvironment
RoleInstance Class
Microsoft.WindowsAzure.ServiceRuntime Namespace

Return to top