locked
For WCF Web Role Values from config file(Azure Role) giving error.For the Web Role it is working fine.Please suggest solution for this. RRS feed

  • Question

  • Currently  I am working on adding word files to the azure blob storage.

    For this we are using WCF web role.

    We are referring this WCF service in the Windows Application.

     

    Problem is when I am using  var storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");in the WCF service 

    Error is thrown as follows :

     

    Error While Creating the Container:SetConfigurationSettingPublisher needs to be called before FromConfigurationSetting can be used

     

    In web role I have already added  following piece of code in the start method but Still getting same error:

     

     

      Microsoft.WindowsAzure.CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>

                {

                    configSetter(Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(configName));

                });

     

     

    For web application it is working fine.

     

    And  in web service method I am using following piece of code

    Method()

    {

    var storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");

                    cloudblobclient = storageAccount.CreateCloudBlobClient();

                    CloudBlobContainer blobcontainer = cloudblobclient.GetContainerReference("abc");

                    blobcontainer.CreateIfNotExist();

     

    }

     

     

    Tuesday, February 15, 2011 10:57 AM

All replies