Compartir a través de


RoleEnvironment.GetConfigurationSettingValue Method (String)

 

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

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

Syntax

[SecurityPermissionAttribute(SecurityAction.Assert, UnmanagedCode = true)]
public static string GetConfigurationSettingValue(
    string configurationSettingName
)
public:
[SecurityPermissionAttribute(SecurityAction::Assert, UnmanagedCode = true)]
static String^ GetConfigurationSettingValue(
    String^ configurationSettingName
)
[<SecurityPermissionAttribute(SecurityAction.Assert, UnmanagedCode = true)>]
static member GetConfigurationSettingValue : 
        configurationSettingName:string -> string
<SecurityPermissionAttribute(SecurityAction.Assert, UnmanagedCode := True)>
Public Shared Function GetConfigurationSettingValue (
    configurationSettingName As String
) As String

Parameters

Return Value

Type: System.String

Type: System.String

A String that contains the value of the configuration setting.

Exceptions

Exception Condition
RoleEnvironmentException

The configuration setting that was being retrieved does not exist.

Remarks

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 the following information:

The GetConfigurationSettingValue method can be used to retrieve the value that is defined in the ServiceConfiguration.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");

See Also

RoleEnvironment Class
Microsoft.WindowsAzure.ServiceRuntime Namespace

Return to top