C#连接mqtt,服务器没有返回消息导致代码卡住

同一个emqx容器,两个代码跑的客户端,一个能连一个不能连。尝试过换电脑均无法连接。使用mqttx可以正常连接,但是其中一个代码跑的客户端死活连不上。升级emqx5.3.2后,使用日志跟踪客户端连接过程日志如下

2023-12-18T01:23:56.743805+00:00 [MQTT] WebBB:24917df3-ea1e-45a5-87e5-5d6ffca85bc3@111.121.71.236:6451 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=WebBB:24917df3-ea1e-45a5-87e5-5d6ffca85bc3, ProtoName=MQTT, ProtoVsn=4, CleanStart=false, KeepAlive=2000, Username=admin, Password=******)
2023-12-18T01:23:56.743957+00:00 [AUTHN] WebBB:24917df3-ea1e-45a5-87e5-5d6ffca85bc3@111.121.71.236:6451 msg: authenticator_result, authenticator: password_based:built_in_database, result: {ok,#{is_superuser => false}}
2023-12-18T01:23:56.744001+00:00 [AUTHN] WebBB:24917df3-ea1e-45a5-87e5-5d6ffca85bc3@111.121.71.236:6451 msg: authentication_result, reason: chain_result, result: {stop,{ok,#{is_superuser => false}}}
2023-12-18T01:23:56.744449+00:00 [MQTT] WebBB:24917df3-ea1e-45a5-87e5-5d6ffca85bc3@111.121.71.236:6451 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=0, ReasonCode=0)

此时客户端没有收到服务端返回的连接建立成功信息,一直在等待
连接代码如下

var cid = “Web:” + Guid.NewGuid().ToString();
var options = new MqttClientOptionsBuilder()
.WithClientId(cid)
.WithTcpServer(MqttIP, MqttPort)
.WithCredentials(MqttUserName, Mqttpwd)
.WithCleanSession(false)
.WithKeepAlivePeriod(TimeSpan.FromSeconds(2000))
.Build();
await mqttClient.ConnectAsync(options);
if (mqttClient.IsConnected)
{

 var message = new MqttApplicationMessageBuilder()
     .WithTopic(topic)
     .WithPayload(mess)
     .WithAtMostOnceQoS()
     .WithRetainFlag(false)
     .Build();

 await mqttClient.PublishAsync(message);

 mqttClient.Dispose();

}
else
{
throw new Exception(“mqtt服务器连接失败”);
}

后面使用同一镜像重新创建emqx容器后仍然无法连接
第二次重建emqx容器后连接正常,原因未知

希望各位有类似经验的能否分享一下,感谢!

日志中看到了 EMQX 给 客户端发送了 CONNACK 报文,请检查客户端侧的 ConnectAsync 回调。

5d6ffca85bc3@111.121.71.236:6451 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=0, ReasonCode=0)