gpt4 book ai didi

authentication - ASP.Net Core 从 VS2015 迁移到 VS2017 时,无法加载文件或程序集“System.Diagnostics.DiagnosticSource”

转载 作者:行者123 更新时间:2023-12-03 22:59:42 52 4
gpt4 key购买 nike

我在 ASP.Net Core(4.6.1 框架)中有一个 Web,它使用 Facebook 和 MS 外部登录,我用 Visual Studio 2015 创建并在昨天发布的新 Visual Studio 2017 中打开。 VS2017 对 csproj、project.json 等文件做了一些更改。

除了一部分之外,该站点编译和执行得很好。如果我使用 Facebook 或 Microsoft 外部登录,该站点会显示此陷阱:

FileLoadException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

System.Net.Http.WinHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
AggregateException: Unhandled remote failure.

Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler+<HandleRemoteCallbackAsync>d__6.MoveNext()

浏览器中的 url 显示它试图从外部登录返回到本地( https://localhost:44321/signin-facebook?code= ... 或/signin-microsoft)。

System.Diagnostics.DiagnosticSource.dll(和 System.Net.Http.dll)的版本号是 4.6.24705.1。

我从头开始一个新的 VS2017 项目,添加了 Facebook 和 MS 登录,它运行良好 - 让我在没有陷阱的情况下登录。 dll是相同的版本。

比较两个 csproj 文件显示了差异,但没有什么明显的(与系统 dll 无关):

Differences in csproj file

最佳答案

为我解决的是向新迁移的项目添加对 System.Net.Http(版本 4.3.1)的 NuGet 引用。
https://www.nuget.org/packages/System.Net.Http/

关于authentication - ASP.Net Core 从 VS2015 迁移到 VS2017 时,无法加载文件或程序集“System.Diagnostics.DiagnosticSource”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42674661/

52 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com