azure - 未找到应用程序依赖项清单中指定的程序集
问题描述
所以我有一个 .NET Core 2.2 Web 应用程序。我向其中添加了 EPPlus 库,现在,当它发布到 Azure(应用服务)时,它不会启动,并且出现错误:
HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure
我通过在 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"
}
}
}
如果我删除整个“runtimeTargets”部分,那么应用程序就可以工作了!(好吧,我也必须为更多的 dll 做同样的事情:System.Drawing.Common 和 System.Security.Cryptography.Pkcs)
但是,只要文件被发布和发布,它就会完全重新生成 - 所以它不是一个可行的解决方案。我也不知道文件的那个部分是做什么的。把它留在里面可能很重要。虽然这一切都有效,所以它不可能那么重要......
它是通过 TeamCity 构建和发布的 - 我不是该过程的专家,但我认为正在运行的命令相当于:
dotnet publish my.proj.csproj --configuration RELEASE --no-restore --no-build
其他尝试过:<PublishWithAspNetCoreTargetManifest>false</ PublishWithAspNetCoreTargetManifest>没有效果
有人有想法么?
解决方案
我有同样的问题。构建后,我通过 DOS 命令将所有文件复制到“生产”目录,copy
因此“运行时”子文件夹中的文件丢失了。复制包括所有子目录的所有文件(通过使用xcopy
)解决了这个问题。
推荐阅读
- sql - 使用 COPY 将 csv 读入数据库,同时添加常量列
- javascript - 使用多个反应 metis 菜单,只允许一个活动项目
- reactjs - 为什么重定向不起作用?(反应路由器 dom)
- pandas - 预定义 pandas 聚合并使用新版本重命名
- javascript - 从模板渲染元素
- python-3.x - 如何使用 MongoEngine 获取数据库中的集合列表?
- ios - 如何在模拟器或真机上安装 ipa 文件?
- java - Spring Data JPA - 使用现有的嵌套子对象持久化新对象
- node.js - 从 aws lambda 调用外部 API 并在 lambda 函数中将响应作为回调
- ios - 是否可以向 IOS 控制中心添加自定义应用程序?