导出 (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