Background :
I have an Azure application with one web role, which is an ASP.NET (C #) application that uses a charting application to display calculation results. A charting application requires input of an XML file. To access this XML file (JavaScript link), I use XDocument and its related classes to manage the file, and then save it, the chart control is loaded when the page is refreshed.
The error is :
When I try to work (GetPermissions, Create, Create, if it does not exist, etc.) in the container , I get the following error:
The server failed to authenticate the request. Verify that the authorization header value is configured correctly, including the signature.
I also tried to create the container in advance using SpaceBlock, this did not seem to change the result.
Code :
Here is the function that I call on the_Load page. The error occurs in bold (GetPermissions):
private void InitializeStorage()
{
if (storageInitialized)
{
return;
}
lock (gate)
{
if (storageInitialized)
{
return;
}
try
{
CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
{
configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
});
var storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
blobStorage = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobStorage.GetContainerReference("xml");
**var permissions = container.GetPermissions();**
permissions.PublicAccess = BlobContainerPublicAccessType.Container;
container.SetPermissions(permissions);
CloudBlob opcBlob = container.GetBlobReference("OptionPriceChart.xml");
opcBlob.DownloadToFile("opcLocal.xml");
}
catch (WebException)
{
throw new WebException("Storage services initialization failure. "
+ "Check your storage account configuration settings. If running locally, "
+ "ensure that the Development Storage service is running.");
}
storageInitialized = true;
}
}
source
share