RoleInstance Class
Represents an instance of a role.
Namespace: Microsoft.WindowsAzure.ServiceRuntime
Assembly: Microsoft.WindowsAzure.ServiceRuntime (in Microsoft.WindowsAzure.ServiceRuntime.dll)
Inheritance Hierarchy
System.Object
Microsoft.WindowsAzure.ServiceRuntime.RoleInstance
Syntax
public abstract class RoleInstance
public ref class RoleInstance abstract
[<AbstractClass>]
type RoleInstance = class end
Public MustInherit Class RoleInstance
Properties
Name | Description | |
---|---|---|
FaultDomain | Gets an integer value that indicates the fault domain in which the role instance is running. |
|
Id | Gets the instance identifier (ID) of the role instance. |
|
InstanceEndpoints | Gets the set of endpoints that are associated with the role instance. |
|
Role | Gets the Role object that is associated with the role instance. |
|
UpdateDomain | Gets an integer value that indicates the update domain in which the role instance is running. |
|
VirtualIPGroups |
Methods
Name | Description | |
---|---|---|
Equals(Object) | (Inherited from Object.) |
|
Finalize() | (Inherited from Object.) |
|
GetHashCode() | (Inherited from Object.) |
|
GetType() | (Inherited from Object.) |
|
MemberwiseClone() | (Inherited from Object.) |
|
ToString() | (Inherited from Object.) |
Remarks
A hosted service in Azure can be defined to contain web roles, worker roles, and VM roles. A role is a component of an application that performs specific functionality. A role instance is a running copy of the role in Azure or the Azure Compute Emulator. Roles are defined in the service model for the hosted service. For more information, see Setting Up a Hosted Service for Azure.
The following code example shows how to retrieve information about role instances:
foreach (var role in RoleEnvironment.Roles)
{
foreach (var roleInstance in role.Value.Instances)
{
Trace.WriteLine("Role Instance ID: " + roleInstance.Id, "Information");
foreach (RoleInstanceEndpoint instanceEndpoint in roleInstance.InstanceEndpoints.Values)
{
Trace.WriteLine("Instance endpoint IP address and port: " + instanceEndpoint.IPEndpoint, "Information");
}
Trace.WriteLine("Role instance fault domain: " + roleInstance.FaultDomain, "Information");
Trace.WriteLine("Role for the instance: " + roleInstance.Role.Name, "Information");
Trace.WriteLine("Role instance update domain: " + roleInstance.UpdateDomain, "Information");
}
}
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
RoleEnvironment
RoleInstanceEndpoint
RoleEnvironmentException
Microsoft.WindowsAzure.ServiceRuntime Namespace
Return to top