Azure 队列休息 API "Resource Not Found 404"

Azure Queue Rest API "Resource Not Found 404"

在 Angular 应用程序上,我试图使用这种 URL 格式查看 Azure 队列中的消息(其中包含多条消息):https://myaccount.queue.core.windows.net/myqueue/messages?peekonly=true 来自 Peek Messages | Microsoft Docs

我的要求:(_http是HttpClient的变量名)

return this._http.get('https://***.queue.core.windows.net/***/messages?peekonly=true')

它 returnsstatus: 404, statusText: "The specified resource does not exist." 我已经三次检查我的请求 URL 并确认已启用 CORS。我在这里错过了什么?

Azure 存储 returns 404 未找到,因为存储服务默认是私有的。普通URL未经授权无法访问私有资源

我建议您使用Shared access signature授权您的请求。

转到门户上的存储帐户,单击共享访问签名blade 以生成 sas 令牌。查看消息需要 (Queue/Object/Read) 作为最小权限。参见 permission by operation

然后将生成的 SAS 令牌附加到您的 url,请注意,您需要将 ? 替换为 &,因为它是 url 中的第二个查询参数。