【问题标题】:C# Core application and DapperC# 核心应用程序和 Dapper
【发布时间】:2018-04-29 04:09:08
【问题描述】:

我有一个 .Net 4.6 WebAPI->LogicLayer->Data Accessor 应用程序... Data Accessor 使用 Dapper 从数据库中获取数据。

我正在转换为 Core,所以从 WebAPI 层开始。但是,当我的逻辑层调用我的数据访问方法时,我得到了一个错误:

"ClassName": "System.IO.FileNotFoundException",
  "Message": "Could not load file or assembly 'Dapper.StrongName, Version=1.50.4.0, Culture=neutral, PublicKeyToken=e3e8412083d25dd3'. The system cannot find the file specified.",
  "Data": null,
  "InnerException": null,
  "HelpURL": null,
  "StackTraceString": "   at Data.AuthenticationData.AuthenticateAsync(LoginRequest request)\r\n   at Logic.AuthenticationLogic.<AuthenticateAsync>d__3.MoveNext() in C:\\Storage\\VSTS_Repo\\Home Finance\\Logic\\AuthenticationLogic.cs:line 36\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at AuthenticationService.Controllers.AuthController.<LoginAsync>d__0.MoveNext() in C:\\Storage\\VSTS_Repo\\Home Finance\\01.AuthenticationService\\Controllers\\AuthController.cs:line 25",
  "RemoteStackTraceString": null,
  "RemoteStackIndex": 0,
  "ExceptionMethod": null,
  "HResult": -2147024894,
  "Source": "Data",
  "WatsonBuckets": null,
  "FileNotFound_FileName": "Dapper.StrongName, Version=1.50.4.0, Culture=neutral, PublicKeyToken=e3e8412083d25dd3",
  "FileNotFound_FusionLog": ""

由于某种原因,当它尝试连接到我的数据访问器项目 (4.6) 时出现错误,这就是错误。自从将 WebAPI 层转换为 Core 后,我怎样才能让它工作?

注意,我发现了一个问题,用户从 Dapper 更改为 Dapper.StrongNamed 并且它有效,但这并没有解决我的问题,我想恢复为“Dapper”。我没有更新。即包是最新的。这听起来也可能是核心和“引用库”的问题,但是......我不知道如何解决它。

(通过 Nuget 将“Dapper”添加到 API 项目可以解决问题,但这似乎不是“解决方案”)

【问题讨论】:

    标签: c# asp.net-core dapper


    【解决方案1】:

    将所有项目转换为核心,问题就消失了。似乎是引用和.Net 版本混合的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-17
      • 2020-12-03
      • 1970-01-01
      • 2018-05-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多