-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.9.2
-
Component/s: Connectivity
-
None
-
Environment:docker on ubuntu linux in azure.
-
(copied to CRM)
I cannot connect to mongoDB atlas using an srv record. I am using a peered connection in azure. The host machine itself can resolve the SRV record. I tested it using this command on my ubuntu sever.
host -t srv _mongodb._tcp.xxxxxxxxx.azure.mongodb.net
An example of my connnection string: mongodb+srv://<username>:<password>@xxxxxxxxx.azure.mongodb.net/test.
I am using .net core 3. The base container of my docker container is mcr.microsoft.com/dotnet/core/aspnet:3.0-alpine3.9 .
Here's the exception i get:
Unhandled exception. DnsClient.DnsResponseException: Unhandled exception 2019-11-12T09:46:08.645385629Z ---> System.InvalidOperationException: Record reader index out of sync. 2019-11-12T09:46:08.645410429Z at DnsClient.DnsRecordFactory.GetRecord(ResourceRecordInfo info) 2019-11-12T09:46:08.645418229Z at DnsClient.DnsMessageHandler.GetResponseMessage(ArraySegment`1 responseData) 2019-11-12T09:46:08.645438129Z at DnsClient.DnsUdpMessageHandler.Query(IPEndPoint server, DnsRequestMessage request, TimeSpan timeout) 2019-11-12T09:46:08.645443729Z at DnsClient.LookupClient.ResolveQuery(IReadOnlyCollection`1 servers, DnsMessageHandler handler, DnsRequestMessage request, Boolean useCache, LookupClientAudit continueAudit) 2019-11-12T09:46:08.645449029Z --- End of inner exception stack trace --- 2019-11-12T09:46:08.645453629Z at DnsClient.LookupClient.ResolveQuery(IReadOnlyCollection`1 servers, DnsMessageHandler handler, DnsRequestMessage request, Boolean useCache, LookupClientAudit continueAudit) 2019-11-12T09:46:08.645458929Z at DnsClient.LookupClient.QueryInternal(IReadOnlyCollection`1 servers, DnsQuestion question, Boolean useCache) 2019-11-12T09:46:08.645463929Z at DnsClient.LookupClient.Query(String query, QueryType queryType, QueryClass queryClass) 2019-11-12T09:46:08.645468929Z at MongoDB.Driver.Core.Configuration.ConnectionString.Resolve(Boolean resolveHosts) 2019-11-12T09:46:08.645473530Z at MongoDB.Driver.MongoUrl.Resolve(Boolean resolveHosts) 2019-11-12T09:46:08.645478430Z at MongoDB.Driver.MongoClientSettings.FromUrl(MongoUrl url)
When using an oldschool connection string (not depending on an srv record) I can connect to my cluster.
- duplicates
-
CSHARP-2968 Exception occurs when using mongodb+srv connection string
- Closed