简体   繁体   中英

Azure - Invalid header for rest request in worker role

Im having problems when executing blobcontainer.CreateIfNotExist(); in my worker role stating this :

Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

At the beggining I thought that the problem could be my local computer date (since im from south america) so I added Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; but the error continued..

The way im getting the configuration for my connection with the storage is like this :

 var storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("dataconnectionstring"));

Which is :

<Setting name="dataconnectionstring" value="DefaultEndpointsProtocol=https;
               AccountName=devstoreaccount1;
               AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" />

What could be the problem?

The problem is with your connection string. I see that you're trying to connect to development storage (storage emulator):

<Setting name="dataconnectionstring" value="DefaultEndpointsProtocol=https;
           AccountName=devstoreaccount1;
           AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" />

For connecting to development storage, please specify the connection string in the following format:

<Setting name="dataconnectionstring" value="UseDevelopmentStorage=true" />

Please use the format that you're using to specify connection to a cloud storage account.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM