微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

创建从 .netcore 3.1 到 Amazon MQ (RabbitMQ) 的连接时出错

如何解决创建从 .netcore 3.1 到 Amazon MQ (RabbitMQ) 的连接时出错

我下面的代码是在 .netcore 3.1(使用 RabbitMQ.Client 6.1)连接到 AmazonMQ (RabbitMQ)

factory = new ConnectionFactory
{
    HostName = "amqps://xxxxxxxxxxxxxxxx.amazonaws.com",UserName = "username",Password = "password",Port = 5671
};        
                
factory.Uri = new Uri(string.Format("{0}:{1}",factory.HostName,factory.Port));         
connection = factory.CreateConnection();

我使用自容器发布代码,它在机器 (Windows 10) 中运行良好,但是当我在 Windows 7 中运行它时,出现此错误

[ERR] Could not make connection to RabbitMQ on Amazon MQ
RabbitMQ.Client.Exceptions.brokerUnreachableException: None of the specified endpoints were reachable
 ---> System.AggregateException: One or more errors occurred. (Authentication Failed,see inner exception.)
 ---> System.Security.Authentication.AuthenticationException: Authentication Failed,see inner exception.
 ---> System.ComponentModel.Win32Exception (0x80090302): The function requested is not supported
   --- End of inner exception stack trace ---
   at System.Net.Security.SslStream.StartSendAuthResetSignal(ProtocolToken message,AsyncProtocolRequest asyncRequest,ExceptiondispatchInfo exception)
   at System.Net.Security.SslStream.CheckCompletionBeforeNextReceive(ProtocolToken message,AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.StartSendBlob(Byte[] incoming,Int32 count,AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.ProcessReceivedBlob(Byte[] buffer,AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer,Int32 readBytes,AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
--- End of stack trace from prevIoUs location where exception was thrown ---
   at System.Net.Security.SslStream.ThrowIfExceptional()
   at System.Net.Security.SslStream.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult result)
   at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
   at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__64_2(IAsyncResult iar)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar,Func`2 endFunction,Action`1 endAction,Task`1 promise,Boolean requiresSynchronization)
--- End of stack trace from prevIoUs location where exception was thrown ---
   at RabbitMQ.Client.Impl.SslHelper.<>c__displayClass2_0.<Tcpupgrade>b__0(SslOption opts)
   at RabbitMQ.Client.Impl.SslHelper.Tcpupgrade(Stream tcpstream,SslOption options)
   at RabbitMQ.Client.Impl.socketFrameHandler..ctor(AmqpTcpEndpoint endpoint,Func`2 socketFactory,TimeSpan connectionTimeout,TimeSpan readTimeout,TimeSpan writeTimeout)
   at RabbitMQ.Client.Framing.Impl.IProtocolExtensions.CreateFrameHandler(IProtocol protocol,AmqpTcpEndpoint endpoint,TimeSpan writeTimeout)
   at RabbitMQ.Client.ConnectionFactory.CreateFrameHandler(AmqpTcpEndpoint endpoint)
   at RabbitMQ.Client.EndpointResolverExtensions.SelectOne[T](IEndpointResolver resolver,Func`2 selector)
   --- End of inner exception stack trace ---
   at RabbitMQ.Client.EndpointResolverExtensions.SelectOne[T](IEndpointResolver resolver,Func`2 selector)
   at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.Init(IEndpointResolver endpoints)
   at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver,String clientProvidedname)
   --- End of inner exception stack trace ---
   at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver,String clientProvidedname)
   at RabbitMQ.Client.ConnectionFactory.CreateConnection(String clientProvidedname)
   at RabbitMQ.Client.ConnectionFactory.CreateConnection()

经过一段时间挖掘错误搜索并尝试(例如关闭防火墙,为我的应用程序添加入站出站规则)后,我不知道如何解决这个问题。任何人都可以帮我解决这个问题。非常感谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。