asp.net-core - Kestrel 失败 : Can not load Microsoft. Extensions.Logging.Abstractions

标签 asp.net-core identityserver4 kestrel-http-server

我有一个非常简单的 Kestrel/ASP.NET Core 项目成功部署到我的 Windows 2008 R2 服务器..(从一个空的 Web 项目 + IdentityServer4 nuget I was following this Getting Started page 开始)

因此,我最初可以检索“发现”JSON 文档。

然后,(per this guide)我添加了几个 NuGet 包,一些 View /CSS 等...

  • Microsoft.AspNetCore.Mvc -版本 1.1.0
  • Microsoft.ApsNetCore.StaticFiles -版本 1.1.0

  • 升级后的解决方案在我的 Win7 开发盒上运行良好,但是在重新部署之后……现在我得到了可怕的 502.5 错误页面。如果我进入服务器并尝试通过命令行“跳转启动”可执行文件..我可以看到这个错误:

    Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=1.1.1.0, Culture=neutral,PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at Ross.Web.Applications.Identity.Program.Main(String[] args)



    我哪里做错了?

    我可以看到前面提到的 DLL,Microsoft.Extensions.Logging.Abstractions ,发布到服务器的文件系统。我猜我需要做一个绑定(bind)重定向什么的,但是,我太新了,不知道怎么做。

    更新
    将我的 NuGet 包升级到最新后.. 错误类似,但现在找不到:Microsoft.AspNetCore.Hosting.Abstractions, Version=1.1.2.0

    最佳答案

    有多个项目在解决方案的人,关注:
    这主要是因为您的解决方案中有多个项目,并且提到的包都安装在它们中,但带有 不同版本 .
    假设异常如下所示:
    enter image description here
    只需停止调试并转到 Manage NuGet Packages for Solution并在已安装选项卡中搜索该软件包:
    enter image description here
    正如你所看到的,我在两个不同版本的项目中都有这个包,这就是重点!只需将较低版本更新为较高版本即可。

    关于asp.net-core - Kestrel 失败 : Can not load Microsoft. Extensions.Logging.Abstractions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43941705/

    相关文章:

    angular - .Net Core API CORS,只锁定一个域(Angular 应用程序)

    c# - Identity Server 4 不向 Controller 返回错误描述

    asp.net-core-webapi - 使用身份服务器 4 和 Asp.net Core API 获得 401 未经授权的有效访问 token

    asp.net-core - 如何停止自托管 Kestrel 应用程序?

    asp.net-core - 在 Asp.net Core 中使用 Swagger 进行流畅验证

    asp.net-core - 如何解决 ASP.NET Core 2.0 应用程序 EF Core 使用中的大量内存分配问题?

    azure - 容器的 Web 应用程序 - Http 503

    .net - IdentityServer4 存储客户端 secret

    https - 在 Windows 网络服务器上使用公共(public)证书运行/配置自托管控制台应用程序(ASP.net 核心 2.1、Kestrel)时出现问题

    c# - 启动后添加新的 FileServer 位置(启动后编辑中间件)