【问题标题】:MVC 6: System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.DiagnosticSourceMVC 6:System.IO.FileNotFoundException:无法加载文件或程序集'System.Diagnostics.DiagnosticSource
【发布时间】:2016-08-16 11:04:29
【问题描述】:

我在暂存环境中遇到此错误,但在本地环境中没有。暂存服务器是 Windows Server 2008 R2。

System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

暂存环境在某一时刻工作,并且此错误是最近出现的。我从错误日志中得到这个错误。该网站只是旋转,不显示任何内容。

两个环境具有相同的 dnx 版本

C:\Users\Me>dnx --version
Microsoft .NET Execution environment
Version:      1.0.0-rc1-16609
Type:         Clr
Architecture: x86
OS Name:      Windows
OS Version:   6.1
Runtime Id:   win7-x86

解决方案是使用 dnx-clr-win-x86.1.0.0-rc1-update2。

我将“System.Diagnostics.DiagnosticSource”包添加到解决方案中的所有项目并进行了部署。那什么也没做。

我从包目录中抓取 System.Diagnostics.DiagnosticSource.dll 并将其放入“runtimes\dnx-clr-win-x86.1.0.0-rc1-update2\bin”目录中。然后我得到一个错误这个错误

Could not load file or assembly 'System.Numerics.Vectors, Version=4.1.1.0

我将 System.Numerics.Vectors.dll 放入 bin 目录中,就像对 DiagnosticSource.dll 所做的那样,但我仍然收到缺少 Vectors.dll 的错误。我不相信我应该将 DLL 放入运行时 bin 目录中。我该如何解决?

更新

Active Version           Runtime Architecture OperatingSystem Alias
------ -------           ------- ------------ --------------- -----
   1.0.0-beta8       clr     x86          win
   1.0.0-beta8       coreclr x86          win
   1.0.0-rc1-final   clr     x64          win
   1.0.0-rc1-final   clr     x86          win
   1.0.0-rc1-final   coreclr x64          win
   1.0.0-rc1-final   coreclr x86          win
   1.0.0-rc1-update1 clr     x64          win
   1.0.0-rc1-update1 clr     x86          win
   1.0.0-rc1-update1 coreclr x64          win
   1.0.0-rc1-update1 coreclr x86          win
  *1.0.0-rc1-update2 clr     x86          win             default

【问题讨论】:

  • 您不应该将包中的 dll 复制到随机位置。您在无法正常工作的机器上安装了哪个版本的 .NET Framework?
  • @Pawel - 我复制 DLL 仅用于调试目的。已更新以列出 .NET 的版本。
  • 能否请您发布您的 project.json 文件。

标签: visual-studio-2015 asp.net-core asp.net-core-mvc


【解决方案1】:

看起来您还没有安装 .Net Framework 4。通常,像 System.Numerics.Vectors 这样的程序集应该从 GAC 加载,而不是从本地 bin 目录加载。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-28
    • 1970-01-01
    • 2023-02-07
    • 1970-01-01
    • 1970-01-01
    • 2012-12-28
    相关资源
    最近更新 更多