gpt4 book ai didi

docker - dotnet 发布后在 docker 镜像中找不到 Application Insights 依赖项

转载 作者:IT老高 更新时间:2023-10-28 12:46:32 26 4
gpt4 key购买 nike

尝试从 docker 镜像运行我的应用程序时收到以下错误:

Error: assembly specified in the dependencies manifest was not found -- package: 'Microsoft.ApplicationInsights.AspNetCore', version: '1.0.2', path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll'

docker 镜像基于 microsoft/aspnetcore

使用 dotnet restoredotnet publish 在 docker 镜像上构建的文件 microsoft/aspnetcore-build:1.1.0-projectjson

{app}.deps.json 中的 "targets" 下我有:

  "Microsoft.ApplicationInsights.AspNetCore/1.0.2": {
"dependencies": {
"Microsoft.ApplicationInsights": "2.1.0",
"Microsoft.AspNetCore.Hosting.Abstractions": "1.0.0",
"Microsoft.AspNetCore.Http.Abstractions": "1.0.0",
"Microsoft.AspNetCore.Mvc.ViewFeatures": "1.0.1",
"Microsoft.Extensions.Configuration": "1.0.0",
"Microsoft.Extensions.DiagnosticAdapter": "1.0.0",
"Microsoft.Extensions.Logging.Abstractions": "1.0.0",
"System.Net.NameResolution": "4.3.0"
},
"runtime": {
"lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll": {}
},
"compile": {
"lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll": {}
}
},

我发布的输出中没有 lib 文件夹,但我发布的输出的根目录中有 Microsoft.ApplicationInsights.AspNetCore

我觉得我错过了一些明显的东西。任何帮助将不胜感激。

更新:

将 Application Insights 更新到 2.0.0 无效。

删除 Application Insights 只是将问题转移到另一个程序集。

切换到独立部署无效。

添加了 COREHOST_TRACE=1 并收到以下输出:

Processing TPA for deps entry [Microsoft.ApplicationInsights.AspNetCore, 2.0.0, lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll]
Considering entry [Microsoft.ApplicationInsights.AspNetCore/2.0.0/lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll] and probe dir [/packagescache/x64]
The hash file is invalid [/packagescache/x64/Microsoft.ApplicationInsights.AspNetCore/2.0.0/Microsoft.ApplicationInsights.AspNetCore.2.0.0.nupkg.sha512]
Skipping... match hash failed
Considering entry [Microsoft.ApplicationInsights.AspNetCore/2.0.0/lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll] and probe dir [/packagescache]
The hash file is invalid [/packagescache/Microsoft.ApplicationInsights.AspNetCore/2.0.0/Microsoft.ApplicationInsights.AspNetCore.2.0.0.nupkg.sha512]
Skipping... match hash failed
Error: assembly specified in the dependencies manifest was not found -- package: 'Microsoft.ApplicationInsights.AspNetCore', version: '2.0.0', path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll'

最佳答案

我通过执行发布文件夹中的应用程序解决了这个问题。例如,如果您在 Ubuntu 16.04 的 Release模式下发布 .net core 1.1 应用程序,您发布的文件将位于

\bin\release\netcoreapp1.1\ubuntu.16.04-x64

此目录中有一个可执行文件,但这不是您要使用的可执行文件。您实际上需要深入一个目录并使用

中的可执行文件

\bin\release\netcoreapp1.1\ubuntu.16.04-x64\publish

关于docker - dotnet 发布后在 docker 镜像中找不到 Application Insights 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42425249/

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