Trying to connect to Atlas from Blazor WASM

The standard connection string [mongodb+srv://] which works locally gives an error

System.ArgumentOutOfRangeException:
List of configured name servers must not be empty.
(Parameter ‘servers’)

I then got another connection string from Atlas UI for older versions [mongodb://] and that failed too

System.PlatformNotSupportedException: Cannot wait on monitors on this runtime.

Is this possible??

**** UPDATE ****

The exception for the second attempt using the older connection string actually times out

System.TimeoutException:
A timeout occured after 30000ms selecting a server using CompositeServerSelector
{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector,
LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }
}.
Client view of cluster state is
{ ClusterId : “1”, ConnectionMode : “ReplicaSet”, Type : “ReplicaSet”, State : “Disconnected”,
Servers : [{ ServerId: “{ ClusterId : 1, EndPoint : “Unspecified/cluster0-shard-00-00.bcbjz.azure.mongodb.net:27017” }”,
EndPoint: “Unspecified/cluster0-shard-00-00.bcbjz.azure.mongodb.net:27017”,
ReasonChanged: “Heartbeat”,
State: “Disconnected”,
ServerVersion: ,
TopologyVersion: ,
Type: “Unknown”,
HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server.
—> System.PlatformNotSupportedException: System.Net.NameResolution is not supported on this platform.

at System.Net.Dns.GetHostAddressesAsync(String hostNameOrAddress)
at MongoDB.Driver.Core.Connections.TcpStreamFactory.ResolveEndPointsAsync(EndPoint initial)
at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStreamAsync(EndPoint endPoint, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Connections.SslStreamFactory.CreateStreamAsync(EndPoint endPoint, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken) — End of inner exception stack trace —
at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)
at MongoDB.Driver.Core.Servers.ServerMonitor.InitializeConnectionAsync(CancellationToken cancellationToken)
at MongoDB.Driver.Core.Servers.ServerMonitor.HeartbeatAsync(CancellationToken cancellationToken)", LastHeartbeatTimestamp: “2021-02-16T18:44:00.7210000Z”, LastUpdateTimestamp: “2021-02-16T18:44:00.7210000Z” }, { ServerId: “{ ClusterId : 1, EndPoint : “Unspecified/cluster0-shard-00-01.bcbjz.azure.mongodb.net:27017” }”, EndPoint: “Unspecified/cluster0-shard-00-01.bcbjz.azure.mongodb.net:27017”, ReasonChanged: “Heartbeat”, State: “Disconnected”, ServerVersion: , TopologyVersion: , Type: “Unknown”, HeartbeatException: “MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. —> System.PlatformNotSupportedException: System.Net.NameResolution is not supported on this platform.
at System.Net.Dns.GetHostAddressesAsync(String hostNameOrAddress)
at MongoDB.Driver.Core.Connections.TcpStreamFactory.ResolveEndPointsAsync(EndPoint initial)
at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStreamAsync(EndPoint endPoint, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Connections.SslStreamFactory.CreateStreamAsync(EndPoint endPoint, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken) — End of inner exception stack trace —
at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)
at MongoDB.Driver.Core.Servers.ServerMonitor.InitializeConnectionAsync(CancellationToken cancellationToken)
at MongoDB.Driver.Core.Servers.ServerMonitor.HeartbeatAsync(CancellationToken cancellationToken)”, LastHeartbeatTimestamp: “2021-02-16T18:44:00.6820000Z”, LastUpdateTimestamp: “2021-02-16T18:44:00.6820000Z” }, { ServerId: “{ ClusterId : 1, EndPoint : “Unspecified/cluster0-shard-00-02.bcbjz.azure.mongodb.net:27017” }”, EndPoint: “Unspecified/cluster0-shard-00-02.bcbjz.azure.mongodb.net:27017”, ReasonChanged: “Heartbeat”, State: “Disconnected”, ServerVersion: , TopologyVersion: , Type: “Unknown”, HeartbeatException: “MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. —> System.PlatformNotSupportedException: System.Net.NameResolution is not supported on this platform.
at System.Net.Dns.GetHostAddressesAsync(String hostNameOrAddress)
at MongoDB.Driver.Core.Connections.TcpStreamFactory.ResolveEndPointsAsync(EndPoint initial)
at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStreamAsync(EndPoint endPoint, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Connections.SslStreamFactory.CreateStreamAsync(EndPoint endPoint, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken) — End of inner exception stack trace —
at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)
at MongoDB.Driver.Core.Servers.ServerMonitor.InitializeConnectionAsync(CancellationToken cancellationToken)
at MongoDB.Driver.Core.Servers.ServerMonitor.HeartbeatAsync(CancellationToken cancellationToken)”, LastHeartbeatTimestamp: “2021-02-16T18:44:00.6550000Z”, LastUpdateTimestamp: “2021-02-16T18:44:00.6550000Z” }] }.
at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)
at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedAsync(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Clusters.Cluster.SelectServerAsync(IServerSelector selector, CancellationToken cancellationToken)
at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterSeverSelctionAsync(CancellationToken cancellationToken)
at MongoDB.Driver.MongoClient.AreSessionsSupportedAsync(CancellationToken cancellationToken)
at MongoDB.Driver.MongoClient.StartImplicitSessionAsync(CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionImpl1.<UsingImplicitSessionAsync>d__1061[[DeleteMeNow.Data.mdbPrices, DeleteMeNow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MongoDB.Driver.IAsyncCursor`1[[DeleteMeNow.Data.mdbPrices, DeleteMeNow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], MongoDB.Driver.Core, Version=2.11.6.0, Culture=neutral, PublicKeyToken=null]].MoveNext()

1 Like

I have the same thing, did you manage to fix it somehow? This drives me crazy o.O

I am pretty sure that the problem was that my hosting provider had the port Atlas uses blocked, which is why it worked locally on my development machine. The Atlas people said I had to use that port, so I ended up using a local database on the hosting machine instead.