简体   繁体   English

无法连接到Azure Service Bus主题

[英]Unable to connect with azure service bus topics

I have create small Poc to send message to azure service bus topic.My code is running without any exception but message not seen in azure service bus topic. 我已经创建了一个小的Poc来向Azure Service Bus主题发送消息。我的代码正在运行,没有任何异常,但是在Azure Service Bus主题中看不到消息。 if any body have any idea about that,please suggest solution. 如果有人对此有任何想法,请提出解决方案。

class Program 班级计划

{
    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;
        }


    }
}

I am attaching snap shot of my code and azure portal details. 我附上我的代码和Azure门户详细信息的快照。

C# Code Azure Portal SnapShot C#代码 Azure门户SnapShot

I can't reproduce it on my side with you mentioned code. 我无法与您提到的代码一起复制它。 If create a new topic or new servicebus account is possible, please use a new servicebus or new topic and try it again. 如果可以创建新主题或新的servicebus帐户,请使用新的servicebus或新主题,然后重试。 The following is my test result on my side. 以下是我这一边的测试结果。 We also could use Azure service bus explorer to check the result. 我们还可以使用Azure服务总线资源管理器来检查结果。 You also could get more demo could code from Get started with Service Bus topics . 您还可以从Service Bus入门主题中获得更多示例代码。

Note: 注意:

  • I refresh topic from the azure portal, then I can get the message info in the azure portal. 我从azure门户刷新主题,然后可以在azure门户中获取消息信息。
  • I use the RootManageSharedAccessKey 我使用RootManageSharedAccessKey

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM