匯出 (0) 列印
全部展開

RoleEnvironment.GetConfigurationSettingValue 方法

Retrieves the value of a setting in the service configuration file.

命名空間: Microsoft.WindowsAzure.ServiceRuntime
組件: Microsoft.WindowsAzure.ServiceRuntime (在 microsoft.windowsazure.serviceruntime.dll 中)

'用途
Dim configurationSettingName As String
Dim returnValue As String

returnValue = RoleEnvironment.GetConfigurationSettingValue(configurationSettingName)

public:
static String^ GetConfigurationSettingValue (
	String^ configurationSettingName
)
public static String GetConfigurationSettingValue (
	String configurationSettingName
)
public static function GetConfigurationSettingValue (
	configurationSettingName : String
) : String

參數

configurationSettingName

The name of the configuration setting.

傳回值

A String that contains the value of the configuration setting.

例外狀況類型條件
RoleEnvironmentException

The configuration setting that was being retrieved does not exist.

Configuration settings for a role are defined in the ServiceDefinition.csdef file and the values for the settings are configured in the ServiceConfiguration.cscfg file. For more information about defining and configuring settings, see Windows Azure Service Configuration Schema and Windows Azure Service Definition Schema.

The GetConfigurationSettingValue method can be used to retrieve the value that is defined in the ServiceDefinintion.cscfg file. The following code example shows how to get and write out the value for a setting called MySetting:


var settingValue = RoleEnvironment.GetConfigurationSettingValue("MySetting"); 
Trace.WriteLine("The setting value is: " + settingValue, "Information");

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

開發平台

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

目標平台

社群新增項目

顯示:
© 2014 Microsoft