FluentValidation Method Not Found 异常的原因是什么?

What is the cause of FluentValidation Method Not Found exception?

我有一个域驱动设计解决方案,出于某种原因,当通过 网关:

One or more errors occurred. (Method not found: 'Void FluentValidation.AbstractValidator`1.When(System.Func`2<!0,Boolean>, System.Action)'.)

出现如下错误:

我有这样的解决方案:

我目前主要关注的 4 个项目是:

  1. Core.Model
  2. Account.Api
  3. Service.Api.Gateway
  4. Web.ClientSite

Web.ClientSiteService.Api.Gateway 发出请求,然后 Service.Api.Gateway 调用 Account.Api。 请注意 Core.Model 被引用 无处不在

非常重要:如果我从 Core.Model 中删除 FluentValidation 的引用,异常就会消失。

我希望这些信息足够了。您认为我为什么会收到此异常,我该如何消除。

看起来某些库 (ocelot) 与 FluentValidation 8.1.2 中的新更改不兼容。尝试降级到 8.1.2 之前的 FluentValidation。希望对你有帮助

我遇到了类似的异常:

System.MissingMethodException : Method not found: 'FluentValidation.AssemblyScanner FluentValidation.AssemblyScanner.FindValidatorsInAssembly(System.Reflection.Assembly)'

就我而言,我还需要升级 ediatR.Extensions.Microsoft.DependencyInjection 和 MediatR.Extensions.FluentValidation.AspNetCore 软件包来解决问题。