c# - Azure 服务总线 - 创建队列时出现无效授权 token 签名错误

标签 c# azure console azure-servicebus-queues

我必须向队列发送消息。我已在 app.config 中指定了连接字符串。我已经在 azure 上设置 SharedAccessKeyName 和 SharedAccessKey 并在连接字符串中设置。

我正在使用下面的控制台代码发送消息。

string connString =  ConfigurationSettings.AppSettings["Microsoft.ServiceBus.ConnectionString"];
NamespaceManager namespaceManager = NamespaceManager.CreateFromConnectionString(connString);


            QueueClient client = QueueClient.CreateFromConnectionString(connString, "testqueue");
            BrokeredMessage message = new BrokeredMessage("test");
            client.Send(message);
            Console.ReadLine();

我收到错误:

40103: Invalid authorization token signature ...

如何解决这个问题?

最佳答案

How to resolve this issue?

根据您提到的异常无效的授权 token 签名,我假设错误发生在连接字符串中。

Endpoint=sb://{servicebusName}.servicebus.windows.net/;SharedAccessKeyName={policyName};SharedAccessKey=xxxx";

我们可以从azure门户获取,更多详细信息您可以引用截图。我们也可以引用Get started with Service Bus queues .

enter image description here

注意:如果您使用添加的 SAS 策略,请确保其具有发送消息的权限。

enter image description here

关于c# - Azure 服务总线 - 创建队列时出现无效授权 token 签名错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48305705/

相关文章:

c# - 接口(interface) C# 的类层次结构

c# - 使用 Selenium C# 获取所选元素下的子元素

c# - 每个实例或每个对象的虚拟表?

c# - 动态 LINQ

java - 如何清除 Java 中的控制台 - Eclipse

Azure 忽略 ARM 模板中的站点配置设置

php - 从 Azure Blob 存储下载 PHP 中的大文件

azure - 查找 Azure 数据工厂 V2 中的事件

python - 在没有控制台的情况下使用 Popen 在 python 中运行进程

c:绘制控制台的表格布局