我必须向队列发送消息。我已在 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 .
注意:如果您使用添加的 SAS 策略,请确保其具有发送消息的权限。
关于c# - Azure 服务总线 - 创建队列时出现无效授权 token 签名错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48305705/