- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试开始使用 Azure ServiceBus,但文档之神反对我。我正在关注this MS article ,这表示此代码将允许我发送消息...
public class Program
{
static string connectionString = "<NAMESPACE CONNECTION STRING>";
static string queueName = "<QUEUE NAME>";
static async Task Main(string[] args)
{
await SendMessageAsync();
}
static async Task SendMessageAsync()
{
// create a Service Bus client
ServiceBusClient client = new ServiceBusClient(connectionString);
// create a sender for the queue
ServiceBusSender sender = client.CreateSender(queueName);
// create a message that we can send
ServiceBusMessage message = new ServiceBusMessage("Hello world!");
// send the message
await sender.SendMessageAsync(message);
Console.WriteLine($"Sent a single message to the queue: {queueName}");
}
}
<小时/>
我为 2 个常量、来自门户的连接字符串和队列名称分配了值,但是当我编译并运行它时,它无法实例化 ServiceBusClient
...
System.ArgumentExceptionHResult=0x80070057Message=The connection string used for an Service Bus client must specify the Service Bus namespace host and either a Shared Access Key (both the name and value) OR a Shared Access Signature to be valid. (Parameter 'connectionString')Source=Azure.Messaging.ServiceBus
进一步挖掘,我发现短语“FullyQualifiedNamespace”被用于连接字符串,因此我用 MyServiceBusName.queue.core.windows.net
替换了我的值并运行它。结果不同但不好......
System.FormatExceptionHResult=0x80131537Message=The connection string could not be parsed; either it was malformed or contains no well-known tokens.Source=Azure.Messaging.ServiceBus
我猜测,从第一次尝试开始,就有一种方法可以将 SAS token 或共享访问 key 作为连接字符串的一部分获取,但我只是不知道如何实现。
我尝试过添加共享访问 key (SAK)
static string connectionString =
"MyServiceBusName.queue.core.windows.net;AccountKey=accountKeyValue
没有乐趣,如果我不包含 SAK 的“名称”元素,同样如此。
同样,我也尝试添加门户给我的 SAS token ,但同样没有任何乐趣。
有人可以告诉我哪些是我应该做而我没有做的吗
更新:
更多的挖掘表明,进行以下更改应该也起作用......
ServiceBusClient client =
new ServiceBusClient(connectionString, new DefaultCredentials())
<小时/>
将我的连接字符串设置为 MyServiceBusName.queue.core.windows.net
和修改后的构造函数,它会实例化 ServiceBusClient
好的,但随后就会挂起,最终,在尝试实际发送消息时超时。
队列似乎工作正常,因为我可以在门户中添加消息并在我的计算机上使用的存储资源管理器实例中查看它们。同样,我可以在存储资源管理器中创建消息并在门户中查看它们。
最佳答案
这是为服务总线命名空间指定连接字符串的方式:
Endpoint=sb://namespacename.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=yZOy10HAJTNkyaKOqwjSricOEud7QLK7R62KyVfjCt4=
您可以通过进入 共享访问策略
> RootManageSharedAccessKey
> 主要(或辅助)连接字符串
从 Azure 门户获取此信息。服务总线命名空间。
更新
您似乎正在尝试使用属于 Azure 存储一部分的存储队列。如果是这种情况,那么您的连接字符串将是:
DefaultEndpointsProtocol=https;AccountName=accountname;AccountKey=xxxx==;EndpointSuffix=core.windows.net;
请注意,您无法使用 Azure.Messaging.ServiceBus
包来管理存储队列。您将需要使用Azure.Storage.Queues
包。
关于azure - Azure.Messaging.ServiceBus.ServiceBusClient 的连接字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67818140/
Microsoft 将于 2021 年 11 月停止支持服务总线的经典 API(如 here 所述) 在我们的代码中,我们使用 WindowsAzure.ServiceBus包裹。这是一个 ol 软件
我正在迁移到 Azure.Messaging.ServiceBus,并注意到现在不再有名为 Label 的属性 这是一个巨大的问题,因为我们的服务总线规则中使用标签来过滤订阅上的消息。 使用 Azur
我正在迁移到 Azure.Messaging.ServiceBus,并注意到现在不再有名为 Label 的属性 这是一个巨大的问题,因为我们的服务总线规则中使用标签来过滤订阅上的消息。 使用 Azur
我创建了一个非常简单的控制台应用程序,它连接到 Azure ServiceBus 并发送一条消息。我尝试了 Microsoft 的最新库 (Microsoft.Azure.ServiceBus),但无
我有一个使用 Microsoft.Azure.ServiceBus 的消息发布者,需要将其替换为 Azure.Messaging.ServiceBus,因为它现已弃用。 这是代码: using Mic
我(尝试)使用此代码来创建 ServiceBus 队列: using Azure.Messaging.ServiceBus; using Azure.Messaging.ServiceBus.Admi
我正在尝试更新此函数以使用 Azure.Messaging.ServiceBus 并完全删除 Microsoft.Azure.ServiceBus,但似乎找不到任何相关资源。有人知道如何使用这个包向主
我(尝试)使用此代码来创建 ServiceBus 队列: using Azure.Messaging.ServiceBus; using Azure.Messaging.ServiceBus.Admi
我正在尝试更新此函数以使用 Azure.Messaging.ServiceBus 并完全删除 Microsoft.Azure.ServiceBus,但似乎找不到任何相关资源。有人知道如何使用这个包向主
我的客户端是在框架 4.5.1 上运行的 WebForm(使用 Microsoft.ServiceBus 1_1,我的服务器是在 azure 上运行的 .netcore。 服务总线在 Azure 上运
我的客户端是在框架 4.5.1 上运行的 WebForm(使用 Microsoft.ServiceBus 1_1,我的服务器是在 azure 上运行的 .netcore。 服务总线在 Azure 上运
我已开始使用 Azure 中的 Azure 服务总线。通过互联网上的一些引用资料,人们似乎使用 Microsoft.ServiceBus.Messaging 中的 BrokeredMessage 类,
我有一段时间编写的客户端使用旧库并调用 GetBody()接收消息时读取正文。 现在我有了新客户 Microsoft.Azure.ServiceBus (发送消息)据我所知总是使用 Stream .
我有几个网站在 Azure 中运行,大量使用 ServiceBus(也在 Azure 中托管),全部位于一个区域。 有时(每 2-3 天一次)我同时在所有网站上出现相同的错误(在阅读/等待消息期间):
我知道 Rebus 完全有能力将消息从 A 点传输到 B(使用 MSMQ 作为传输层)。为了让事情完全清楚,Rebus 是否也能够进行一对多消息传递,即从 A 点发送的消息应该在 B 点和 C 点结束
在 SOA 项目中使用服务总线架构的优缺点是什么? 您会推荐哪些建议的开源服务总线平台? 提前致谢 最佳答案 我认为服务总线的优缺点与您项目中的要求有关。它可以根据需要进行调整。 您可以使用 JMS
在代码中我需要原子地: //write to a database table //publish EventA to service bus //write to another database
我对使用服务总线和其他 Azure 功能还很陌生。在 Azure 门户上手动创建服务总线后,我尝试弄清楚如何自动实现这一点。经过一段时间的阅读后,我认为使用 azure 资源管理器应该是正确的选择。仅
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我正在将 Microsoft Azure ServiceBus 用于队列消息,并使用 WCF 进行订阅。我正在尝试实现重试逻辑。我使用 Peak/Lock 查看消息,然后必须对消息进行一些本地处理。如
我是一名优秀的程序员,十分优秀!