简体   繁体   English

MongoDB C# 驱动程序返回 MissingMethodException。 任何解决方法?

[英]MongoDB C# driver returns MissingMethodException. Any workaround?

I'm writing a fairly simple console app using .NET Core and trying to attach to a Mongo DB.我正在使用 .NET Core 编写一个相当简单的控制台应用程序并尝试附加到 Mongo DB。 It appears that the current release has been broken because of changes to the DnsClient (ie the actual error is: Method not found: 'DnsClient.IDnsQueryResponse DnsClient.LookupClient.Query(System.String, DnsClient.QueryType)'.).由于 DnsClient 的更改,当前版本似乎已被破坏(即实际错误是:找不到方法:'DnsClient.IDnsQueryResponse DnsClient.LookupClient.Query(System.String, DnsClient.QueryType)'。)。 Is anyone aware of a work-around for this problem as the Mongo-ites don't seem in any rush to get a fix out for us poor C# junkies?有没有人知道解决这个问题的方法,因为 Mongo-ites 似乎并不急于为我们这些可怜的 C# 爱好者解决问题?

It looks like there is a ticket created regarding this issue in mongodb issue tracker看起来在 mongodb 问题跟踪器中创建了一张关于此问题的票

https://jira.mongodb.org/browse/CSHARP-2330 https://jira.mongodb.org/browse/CSHARP-2330

Also, there is a comment inside the ticket with a workarund:此外,票证内有一条评论,其中包含一个 workarund:

I found the solution of this problem.我找到了这个问题的解决方案。 DnsClient 1.1.1 cause this error. DnsClient 1.1.1 导致此错误。 downgrade to 1.0.7, and try again.降级到 1.0.7,然后重试。

if you see error "Could not load file or assembly 'DnsClient' or one of its dependencies. Manifest definition does not match the assembly reference",make sure to check redirect setting in web.config.如果您看到错误“无法加载文件或程序集‘DnsClient’或其依赖项之一。清单定义与程序集引用不匹配”,请确保检查 web.config 中的重定向设置。 newVersion section in "dependentAssembly/bindingRedirect" should be "1.0.7.0". “dependentAssembly/bindingRedirect” 中的 newVersion 部分应为“1.0.7.0”。

Actually, I got this exception as well.实际上,我也遇到了这个异常。 Follow the above steps solved my problem.按照上面的步骤解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM