获取“Microsoft.Azure.ServiceBus.ServiceBusCommunicationException”在写一个简单的测试时 [英] Getting a "Microsoft.Azure.ServiceBus.ServiceBusCommunicationException" when writing a simple test
问题描述
您好,
我正在尝试重现此处解释的有关服务总线使用的简单示例: https://docs.microsoft.com/en- us / azure / service-bus-messaging / service-bus-dotnet-get-started-with-queues
但是,我收到以下异常
抛出异常:System.Private.CoreLib.dll中的'Microsoft.Azure.ServiceBus.ServiceBusCommunicationException'
,消息为:
异常:连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机未能响应ErrorCode:TimedOut
堆栈跟踪:  在Microsoft的.Azure.ServiceBus.Core.MessageSender.OnSendAsync(IList`1 messageList)中的C:\\\ source \ azure-service-bus-dotnet \src\Microsoft.Azure.ServiceBus\Core\MessageSender。 cs:第562行
在Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1操作,TimeSpan operationTimeout)中的C:\\\ source \ azure-service-bus-dotnet \src \ Microsoft.Azure.ServiceBus \RetryPolicy。 cs:第85行
在Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1操作,TimeSpan operationTimeout)中的C:\\\ source \ azure-service-bus-dotnet \src \ Microsoft.Azure.ServiceBus \RetryPolicy。 cs:第107行
位于C:\ source \ azure-service-bus-dotnet \ src \ Mysrosoft.Azure.ServiceBus \ Core \中的Microsoft.Azure.ServiceBus.Core.MessageSender.SendAsync(IList`1 messageList) MessageSender.cs:第252行
at ServiceBusHelloWorld.Program.SendMessagesAsync(Int32 numberOfMessagesToSend)in C:\ _dev\ServiceBusHelloWorld\ServiceBusHelloWorld\ServiceBusHelloWorld\Program.cs:line 58
此行中的
(SendMessagesAsync()方法):
//将消息发送到队列
await queueClient.SendAsync(消息);
这可能是非开放端口问题吗?如果是这样,应该使用哪个端口来处理ServiceBus的响应?
我已经完成了文档中提到的确切步骤在帖子中分享,我能够毫无问题地成功运行此功能。这可能是网络防火墙的问题。尝试从不同的网络运行
Hello,
I am trying to reproduce the simple example explained here about the use of Service Bus: https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dotnet-get-started-with-queues
However, I am getting the following exception
Exception thrown: 'Microsoft.Azure.ServiceBus.ServiceBusCommunicationException' in System.Private.CoreLib.dll
with the message:
Exception: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ErrorCode: TimedOut
Stack Trace: at Microsoft.Azure.ServiceBus.Core.MessageSender.OnSendAsync(IList`1 messageList) in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\Core\MessageSender.cs:line 562
at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout) in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\RetryPolicy.cs:line 85
at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout) in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\RetryPolicy.cs:line 107
at Microsoft.Azure.ServiceBus.Core.MessageSender.SendAsync(IList`1 messageList) in C:\source\azure-service-bus-dotnet\src\Microsoft.Azure.ServiceBus\Core\MessageSender.cs:line 252
at ServiceBusHelloWorld.Program.SendMessagesAsync(Int32 numberOfMessagesToSend) in C:\_dev\ServiceBusHelloWorld\ServiceBusHelloWorld\ServiceBusHelloWorld\Program.cs:line 58
in this line (SendMessagesAsync() method):
// Send the message to the queue await queueClient.SendAsync(message);
Could it be an non-open ports issue? If so, what port should be used to handle the ServiceBus' response?
I have gone through the exact steps mentioned in the documentation shared in the post and I am able to successfully run this without any issues. It might be an issue with the network firewall. Try running from different network
这篇关于获取“Microsoft.Azure.ServiceBus.ServiceBusCommunicationException”在写一个简单的测试时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!