c# - 尝试创建 Azure 服务总线队列时出现访问错误

标签 c# azure azureservicebus

我在安装了最新版本的 WindowsAzure.ServiceBus NuGet 包的简单控制台应用程序中运行以下代码:

        var connectionString = "Endpoint=sb://<servername>/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=<SharedAccessKey>";
        var queueName = "TestQueue";

        var ns = NamespaceManager.CreateFromConnectionString(connectionString);

        if (!ns.QueueExists(queueName))
            ns.CreateQueue(queueName);

并收到以下错误:

System.UnauthorizedAccessException was unhandled
  HResult=-2147024891
  Message=The remote server returned an error: (401) Unauthorized. InvalidSignature: The token has an invalid signature. TrackingId:<GUID>_G30, SystemTracker:<MyQueue>.servicebus.windows.net

我尝试了很多不同的方法来尝试修复它,包括删除并重新创建整个命名空间。我还验证了 SharedAccessKey 具有正确的声明(即管理)。

enter image description here

更新

早上回来继续解决这个问题后,它神秘地开始工作了,所以我猜问题已经变成了,这里发生了什么?代码没有改变。 key 没变。 (困惑!)

最佳答案

您遇到的错误 TrackingId:<GUID>_G30表示网关上的问题 MSFT 支持团队应该能够提供帮助。命名空间管理操作通过 HTTPS 进行,我假设您已打开它,即没有任何东西阻止它。因此,我的赌注是与 Azure 支持人员联系,向他们提供 TrackingId找出网关拒绝您的请求的原因。

关于c# - 尝试创建 Azure 服务总线队列时出现访问错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41029520/

相关文章:

c# - 将 C# 项目从 visual studio 2010 降级到 visual studio 2008

c# - XmlSerializer - 第一次反序列化非常慢

c# - HttpWebRequest.GetResponse 方法卡住特定的 url

Azure DevOps Pipelines 停止运行

通过 OData 公开的 Azure Data Lake Store

git - 在 Azure 上使用 Git 子模块持续部署 VSTS 应用程序失败

Azure 服务总线 - TTL 与 ScheduledEnqueueTimeUtc

c# - 如何在 EF 代码优先中使用 Fluent API 配置 TPH?

c# - 当 RegisterEventBus "No service for type Autofac.ILifetimeScope' 已注册时。

azure - Azure 队列中基于租用和基于锁定的独占访问之间的差异