c# - Azure appservice 返回错误 500.30,但我的应用在 kudu (ASP.NET Core) 上运行良好
问题描述
我最近从 .NET Core 3.1 迁移到 .NET 5。我还切换了我的应用服务设置并让它们使用 .NET 5 运行时。
然后我导航到应用程序 url,但收到 500.30 错误。为了诊断,我按照文档的建议执行了以下操作
- 打开酷都,
- 打开一个PowerShell窗口,
- 导航到 wwwroot 文件夹
- 运行 dotnet Myapp.dll
但我的应用程序在 kudu 中运行良好。在应用程序事件日志中,我收到此错误:
物理根目录为“D:\home\site\wwwroot”的应用程序“/LM/W3SVC/1776254318/ROOT”无法加载 coreclr。
异常消息:CLR 工作线程过早退出
进程 ID:11956
。文件版本:15.0.20349.2。描述:IIS ASP.NET Core 模块 V2 请求处理程序。提交:2670c ...
根据文档,这可能是因为我在 64 位操作系统上运行 32 位应用程序。但是在检查了我的操作系统是 win-64 之后,我添加了 win 64 的 RID 并编译了我的应用程序。这仍然没有奏效。有人可以帮忙吗?
解决方案
我发现我的构建管道 yml 没有以最有效的方式编写。通过管道构建和测试我的项目后,我没有正确发布它。我发布了解决方案:
- task: DotNetCoreCLI@2
displayName: 'preparing artifact .zip to publish'
inputs:
command: publish
publishWebProjects: False
arguments: 'MyApp.sln --configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: True
而不是发布项目,这会导致部署问题。
- task: DotNetCoreCLI@2
displayName: 'preparing artifact .zip to publish'
inputs:
command: publish
publishWebProjects: False
arguments: 'MyApp/MyApp.csproj --configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: True
推荐阅读
- googlebot - 遵守 Google 的结构化数据政策
- laravel - Laravel Spark 上传头像到外部驱动
- javascript - Angular 2+从不同的组件更新组件订阅
- python-2.7 - 如何在 Python 中获得浮点数?
- python - 打印文本文件中的句子数
- r - flexdashboard 能看到全局环境吗?
- node.js - throw new TypeError('OAuth2Strategy 需要验证回调');
- java - 如何在已经排序的数组中添加一些东西并让它保持排序而不使用排序数组?
- forms - 不提交帖子值的简单表单
- python - 如何在没有特定日期的python datetime中设置工作日