匯出 (0) 列印
全部展開
本主題尚未接受評分 - 為這個主題評分

Role 類別

Represents a role that is defined as part of a hosted service.

命名空間: Microsoft.WindowsAzure.ServiceRuntime
組件: Microsoft.WindowsAzure.ServiceRuntime (在 microsoft.windowsazure.serviceruntime.dll 中)
'用途
Dim instance As Role

public abstract class Role
public abstract class Role
public abstract class Role

The application that you develop runs as a hosted service in Windows Azure, and the application is built from one or more roles. A role defines a component that may run in the execution environment within Windows Azure. For more information about defining and configuring roles in the service model for a hosted service see, Setting Up a Hosted Service for Windows Azure. Roles that are defined for the hosted service run as role instances in Windows Azure.

The Role class is used to obtain role instance objects. The following code example shows how to retrieve the name of the role and the instance IDs of role instances:


// Display the name of the role
Trace.WriteLine("Role Name: " + RoleEnvironment.CurrentRoleInstance.Role.Name);
   
// Iterate through each instance object and display the identifier
foreach (RoleInstance roleInst in RoleEnvironment.CurrentRoleInstance.Role.Instances)    
{
   Trace.WriteLine("Instance ID: " + roleInst.Id);    
}

You can change the number of role instances that are running by changing the instances count in the ServiceConfiguration.csfg file. For more information about changing the instance count, see How to Scale Applications by Increasing or Decreasing the Number of Role Instances.

note注意事項
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.


System.Object
  Microsoft.WindowsAzure.ServiceRuntime.Role
任何這個類型的公用靜態 (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。 並非所有的執行個體成員都是安全執行緒。

開發平台

Windows XP Home Edition, Windows XP Professional, Windows Server 2003、Windows Server 2008 和 Windows 2000

目標平台

本文對您有任何幫助嗎?
(剩餘 1500 個字元)
感謝您提供意見

社群新增項目

顯示:
© 2014 Microsoft. 著作權所有,並保留一切權利。