Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mdbc failing to connect to mongoDb Atlas with DnsClient error #38

Closed
pawan-regoti opened this issue Apr 6, 2020 · 11 comments
Closed

Mdbc failing to connect to mongoDb Atlas with DnsClient error #38

pawan-regoti opened this issue Apr 6, 2020 · 11 comments

Comments

@pawan-regoti
Copy link

pawan-regoti commented Apr 6, 2020

image

I have a powershell script using Mdbc to connect to mongodb atlas but suddenly it started failing with dns client error. I saw something similar before 2 weeks ago with Mongo C# driver. But updating MongoDb C# driver and adding DnsClient package seems to fix the issue in my vs project.

But i am unable to make it work in powershell as my system already has DnsClient version 1.0.0.0 powershell module (which looks like latest version).

Do you have a workaround for this?

@nightroman
Copy link
Owner

nightroman commented Apr 6, 2020

Can you try a hack, copy the latest DnsClient (1.3.1 or 1.3.0) to the Mdbc installation directory and see if it works? (Mdbc package currently uses 1.2.0, as I can see).

@nightroman
Copy link
Owner

nightroman commented Apr 6, 2020

Here they say the latest version of DnsClient should fix some known MongoDB C# driver issues.

@nightroman
Copy link
Owner

How is it going?

@pawan-regoti
Copy link
Author

pawan-regoti commented Apr 8, 2020

Hi @nightroman ,
Currently I am using powershell so It uses powershell version of Mdbc, so I am not sure if I can directly inject DnsClient 1.3.1 nuget package there.
Microsoft Powershell has embedded DnsClient right of the box and it looks like it is on latest version (1.0.0.0)
https://docs.microsoft.com/en-us/powershell/module/dnsclient/?view=win10-ps

Do you have any suggestions regarding this?

@nightroman
Copy link
Owner

(1) Get the package

nuget install DnsClient

or use other methods (download) and unzip.

(2) Go to one of

DnsClient.1.3.1\lib\net45
DnsClient.1.3.1\lib\netstandard2.0

depending on your Mdbc package (PSGallery is netstandard2.0, NuGet is net45).

(3) get DnsClient.dll there and copy to your Mdbc module location, see

(get-module mdbc -ListAvailable).Path

You should replace the existing DnsClient.dll with the newer one.

Then try your problem case again and let me know the result.

@pawan-regoti
Copy link
Author

Just replacing DnsClient.dll will not cut it as Mdbc.dll is referencing DnsClient version 1.2.0.0
Either Mdbc.dll needs to be updated (which is a bad idea) or a new version of the Mdbc package (which references DnsClient 1.3.1)will fix it.

@pawan-regoti
Copy link
Author

So, just for kicks I tried your suggestion :) , and it gave the same error that I initially theorized
image

@nightroman
Copy link
Owner

and it gave the same error that I initially theorized

It is a different error.

OK, the problem is that not Mdbc is referencing DnsClient but C# driver. We need the driver that references the newer DnsClient. Mdbc cannot help, unfortunately, Try to open the issue there.

All in all, I am about to close the issue. It is not really related to Mdbc.

@pawan-regoti
Copy link
Author

Latest version of MongoDB.Driver.Core has updated the dependency to DnsClient 1.3.1
https://www.nuget.org/packages/MongoDB.Driver.Core/

MongoDB.Driver.Core 2.10.2 -> DnsClient 1.2.0
MongoDB.Driver.Core 2.10.3 -> DnsClient 1.3.1

So, Updating MongoDB.Driver to 2.10.3 will fix this issue.

@nightroman
Copy link
Owner

Aha, it is the good news. Then give me some short time and I will update Mdbc as well.

@nightroman
Copy link
Owner

v6.5.5 Done. Thank you for reporting and helping to fix this (hopefully).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants