MongoDb连接超时

fjnneemd  于 2022-12-29  发布在  Go
关注(0)|答案(1)|浏览(233)

我正在使用mongodb的桌面应用程序。它的工作时,我使用家庭WIFI,但当我使用我的公司WIFI,它得到连接超时错误
我检查了防火墙,它似乎不能阻止它。我该怎么解决这个问题?
例外情况:

System.TimeoutException: 'A timeout occurred after 30000ms 
selecting a server using CompositeServerSelector{ Selectors =
 MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, 
LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000
 }, OperationsCountServerSelector }. Client view of cluster state is {
 ClusterId : "1", ConnectionMode : "ReplicaSet", Type : "ReplicaSet",
 State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, 
EndPoint : "Unspecified/xxxxxxxxxx" }", EndPoint:
 "Unspecified/xxxxxxxx", ReasonChanged: "Heartbeat", State: 
"Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown",
 HeartbeatException: "MongoDB.Driver.MongoConnectionException: An 
exception occurred while opening a connection to the server. --->
 System.Net.Sockets.SocketException: 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 207.46.145.150:27017

ru9i0ody

ru9i0ody1#

我也遇到过同样的问题,最后我发现需要配置一个白色名单来允许访问mongodb。
请参阅此文档:
配置IP访问列表条目。

相关问题