jb.*_*jb. 6 azure epplus .net-core asp.net-core
所以我有一个 .NET Core 2.2 Web 应用程序。我向其中添加了 EPPlus 库,现在,当它发布到 Azure(应用程序服务)时,它不会启动,并且出现错误:
HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure
Run Code Online (Sandbox Code Playgroud)
我通过在 Azure 中运行控制台和命令“dotnet my.project.dll”缩小了范围,并得到了实际错误:
找不到应用程序依赖项清单 (my.project.deps.json) 中指定的程序集:程序包:'Microsoft.Win32.SystemEvents',版本:'4.5.0' 路径:'runtimes/win/lib/netcoreapp2.0 /Microsoft.Win32.SystemEvents.dll'
Microsoft.Win32.SystemEvents.dll 位于应用程序部署到的主 wwwroot 文件夹中。但我认为整个runtimes/win/libs/文件夹根本不存在。
my.project.deps.json 文件的部分如下所示:
"Microsoft.Win32.SystemEvents/4.5.0": {
"dependencies": {
"Microsoft.NETCore.Platforms": "2.2.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Win32.SystemEvents.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.6.26515.6"
}
},
"runtimeTargets": {
"runtimes/win/lib/netcoreapp2.0/Microsoft.Win32.SystemEvents.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.6.26515.6"
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果我删除整个“runtimeTargets”部分,那么应用程序就可以运行!(好吧,我也必须对另外几个 dll 执行相同的操作:System.Drawing.Common 和 System.Security.Cryptography.Pkcs)
但该文件在发布和发布时都会完全重新生成 - 因此这不是一个可行的解决方案。我也不知道该文件的该部分是做什么的。把它留在里面可能很重要。虽然一切都有效,所以它不可能那么重要......
它是通过 TeamCity 构建和发布的 - 我不是该过程的专家,但我认为正在运行的命令相当于:
dotnet publish my.proj.csproj --configuration RELEASE --no-restore --no-build
Run Code Online (Sandbox Code Playgroud)
其他尝试过的事情: <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest> 没有效果
有人有主意吗?
事实证明,这是我的错:(
Team City 根据已发布的输出创建了一个 NuGet 包。但 /runtimes 文件夹未包含在包中,因此从未作为站点的一部分发布。
我编辑了 nuspec 文件以将其包含在 /runtimes 中,并且一切正常。
| 归档时间: |
|
| 查看次数: |
6383 次 |
| 最近记录: |