Azure -工作角色中休息请求的头无效

本文关键字:请求 无效 工作 角色 Azure | 更新日期: 2023-09-27 18:06:54

在我的worker角色中执行blobcontainer.CreateIfNotExist();时遇到问题,说明如下:

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

一开始我认为问题可能是我的本地计算机日期(因为我来自南美),所以我添加了Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;,但错误继续…

我获取与存储连接的配置的方式如下:

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

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

有什么问题吗?

Azure -工作角色中休息请求的头无效

问题是您的连接字符串。我看到您正在尝试连接到开发存储(存储模拟器):

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

要连接到开发存储,请按以下格式指定连接字符串:

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

请使用指定连接到云存储帐户的格式。