【发布时间】:2018-05-29 11:03:38
【问题描述】:
我创建了小型 Poc 来向 azure 服务总线主题发送消息。我的代码正在运行,没有任何异常,但在 azure 服务总线主题中看不到消息。 如果有人对此有任何想法,请提出解决方案。
课堂节目
{
const string ServiceBusConnectionString
= "Endpoint=sb://etservicebus.servicebus.windows.net/;SharedAccessKeyName=ServiceBusTopicSubsription;SharedAccessKey=Q4Cc+xP07NN4R0w=";
const string TopicName = "topic1";
static ITopicClient topicClient;
static void Main()
{
MainAsync().GetAwaiter().GetResult();
}
static async Task MainAsync()
{
try
{
topicClient = new TopicClient(ServiceBusConnectionString, TopicName);
// Send messages
string message = "Testing Message";
await topicClient.SendAsync(new Message(Encoding.UTF8.GetBytes(message)));
}
catch (Exception ex)
{
throw;
}
}
}
我附上了我的代码和天蓝色门户详细信息的快照。
【问题讨论】:
-
请更新您的问题以包含mvce。
-
您没有等待异步方法调用,因此可能会丢失任何错误。
-
应用了等待,现在低于错误。
-
您能否编辑问题并 1)在此处发布代码而不是使用图像,以及 2)在问题中也包含错误消息。更易于所有人阅读。
-
鉴于错误消息,我建议您检查连接字符串和可能的防火墙问题。
标签: c# azure subscription servicebus