1

Hi I am struggling to understand/find a solution to this problem. I have removed the reference to StorageClient 1.7 and the project now uses Storage (2.0). I have a web role like this:

 public override bool OnStart()
    {
        CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>     
configSetter(
           RoleEnvironment.GetConfigurationSettingValue(configName)));

The method SetConfigurationSettingPublisher() does not exist.

Whats does this method do, and how do I replace it? I have seen things like below but don't understand what's happening. What is the _cloudStorageAccount variable and where is it used? What the point of assigning it to this variable? Would storageSettingName be "DataConnectionString" from Service config? Do I need this at all or can it be omitted?

  • var setting = CloudConfigurationManager.GetSetting(storageSettingName);
  • _cloudStorageAccount = CloudStorageAccount.Parse(setting);
Toby Holland
  • 1,029
  • 2
  • 14
  • 29

1 Answers1

0

The MSDN documentation for CloudStorageAccount.Parse shows how to use it:

CloudStorageAccount storageAccount = 
CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageAccountConnectionString"]);

The StorageAccountConnectionString would be a setting in your csdef/cscfg which would look something like:

<Setting name="StorageAccountConnectionString"
         value="DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=+Ngl4GVRy01UUy5uL4cFqoufI/79xWqBAHkNmYODycfY8QW5dZXzqg58AZl1XxJWvGgEUdW/smr1DvfwuyC1jw==" 
         />
slugster
  • 49,403
  • 14
  • 95
  • 145
kwill
  • 10,867
  • 1
  • 28
  • 26