If you are using a WCF Web Role to access table storage you might come across the following error
SetConfigurationSettingPublisher needs to be called before FromConfigurationSetting can be used
The following steps can help you
- Ensure you have the Cloud project set up as the start up project
- Ensure you are using the service reference of the Dev Environment web role and not your local IIS port( Another post on that incase you are facing an Add Service reference issue here but for now just replace the port in the web.config with http://127.0.0.1:81/yourservice.svc).
- If you are using Azure SDK 1.2 then add the following code to your WebRole.cs OnStart method
CloudStorageAccount.SetConfigurationSettingPublisher((configName,configSettingPublisher) =>
{
var connectionString = RoleEnvironment.GetConfigurationSettingValue(configName);
configSettingPublisher(connectionString);
});
- If you are using Azure SDK 1.3 then add a Global.asax to your WebService Web Role and add the following code
protected void Application_Start(object sender, EventArgs e)
{
CloudStorageAccount.SetConfigurationSettingPublisher(
(configName, configSettingPublisher) =>
{
var connectionString =
RoleEnvironment.GetConfigurationSettingValue(configName);
configSettingPublisher(connectionString);
} );
}
- Ensure you have WCF Http Activation On ( in control panel—> Windows Features)
Watch this space for lots more Azure tips!
Cennest!