Managing Configuration Settings in AZURE Cloud Services
AZURE Cloud Configuration
There is a ServiceConfiguration.cscfg file available in AZURE Cloud services created. And the important thing is that, we do not have control to the WebRole or WorkerRole configuration settings when it is deployed. So it is better to don't place any configuration settings through that configs. To hold settings we have to use ServiceConfiguration.cscfg configuration file. There are two types of Service Configuration files placed like local and cloud. Local is for local debugging purpose and another is for cloud deploy.
AZURE Cloud Service Configuration Settings |
Configuring ServiceConfiguration.cscfg
All new settings you are going to place in ServiceConfiguration.cscfg file must be defined in the ServiceDefinition.csdef (definition file). Other wise the cloud service will shown error. You can place any settings in service configuration. And example is given below
Define new setting in ServiceDefinition.csdef
<setting name="ConnectionString"/>
<setting namea="ProviderName"/>
Define new setting in ServiceConfiguration.cscfg
<setting name="ConnectionString" value="{connectionstring}"/>
<setting name="ProviderName" value="{provider name for example like MySql.Data.MySqlClient}"/>
Read AZURE Cloud Service Configuration From Web/Worker Role
There is a class called CloudConfigurationManager in Microsoft.WindowsAzure namespace.
CloudConfigurationManager.GetSetting("ConnectionString");
CloudConfigurationManager.GetSetting("ProviderName");
Managing Configuration Settings in AZURE Cloud Services
Reviewed by Biby
on
11:57 PM
Rating:
No comments: