createQueueService错误的Azure存储模拟器

createQueueService错误的Azure存储模拟器

本文介绍了带有Node.js createQueueService错误的Azure存储模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试连接到模拟的存储队列服务时收到以下错误:

I'm receiving the following error when I try connecting to the emulated storage queue service:

确保包括标题在内的Authorization标头的值正确形成.

Make sure the value of Authorization header is formed correctly including the signature.

这是我用来连接到Azure存储的方法:

This is the approach I'm using to connect to the azure storage:

    var storageAccount = 'devstoreaccount1'
    var accessKey= 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=='
    var azure = require('azure-storage');
    var queueSvc = azure.createQueueService(storageAccount,accessKey);

    queueSvc.createMessage('myqueue', "Hello world!", function(error, results, response){
      if(!error){
        // Message inserted
      }
    });

我还尝试使用以下连接字符串,但未成功:

I also tryed using the following connection strings, without success:

UseDevelopmentStorage=true

DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;
AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;
TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;
QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;

在生产环境中一切正常,该问题仅与模拟服务有关,特别是与队列有关(模拟blob正常工作).

Everything is working properly in production environments, the issue is only related to the emulated service and specifically for the queues (emulated blobs are working as expected).

有什么主意吗?

推荐答案

在使用SDK 2.8.1测试代码后,我重现了您的错误.

I have reproduced your error after testing your code with SDK 2.8.1.

我可以使用 queueSvc.logger.level = azure.Logger.LogLevels.DEBUG; 从控制台获取详细的日志.通过此方法生成的请求uri是 https://devstoreaccount1.queue.core.windows.net:443/myqueue/messages ,用于访问在线存储帐户devstoreaccount1.

I get detailed log from console by using queueSvc.logger.level = azure.Logger.LogLevels.DEBUG;.The request uri generated by this method is https://devstoreaccount1.queue.core.windows.net:443/myqueue/messages, which is used to access storage account online called devstoreaccount1.

要访问存储模拟器,请执行以下操作:

To access storage emulator:

var azure = require('azure-storage');
var devStoreCreds = azure.generateDevelopmentStorageCredentials();
var queueSvc = azure.createQueueService(devStoreCreds);

这篇关于带有Node.js createQueueService错误的Azure存储模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 20:39