c# - Azure 应用服务 - .net 版本支持 - 更新(HTTP 500.31 错误)?

标签 c# .net azure azure-web-app-service

今天我们将 .net 7 Web 应用程序推送到 Azure,突然一切都崩溃了:

HTTP Error 500.31 - ANCM Failed to Find Native Dependencies
Common solutions to this issue:
The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect

我们必须重新发布为自包含(+ 必须将发布设置从 32 位更改为 64 位(也在应用服务常规配置中))。

现在,由于自给自足,它似乎可以工作。

不知道为什么以前从未发生过。昨天我们发布了,一切正常。今天只是更新了 css,导致了 HTTP 500.31 错误。

搜索后,我发现一个 SO 线程,其中扩展(应用程序服务 > 开发工具)中的更新导致了 500.31 错误,但在我们的例子中它没有解决它。

当我们通过应用服务的 Azure 控制台执行 dotnet --info 时,我们看到已安装 Microsoft.NetCore.Appcore/Microsoft.AspNetCore.App 7.0.2 和 .net sdk 7.0。 102.

但是,当通过应用服务编辑器查看我们的 projectname.runtimeconfig.json 时,它被设置为 "version": "7.0.5"

这对于已安装的 .net (sdk) 版本意味着什么?

Microsoft 是否仅将特定版本的 .net/.net sdk 更新/部署到 Azure 应用服务? (如果有,是否有更新/支持版本的列表以及更新时间?)

或者我们是否需要使用版本特定的 dotnet-install 脚本手动为 Azure 中的应用服务安装新的 .net/.net sdk?

最佳答案

[HTTP 500.31 Error

当我们使用的版本和部署的 Azure 应用程序存在兼容性问题时,通常会出现此错误。

  • 我已将 .NET Core 7 WebApp 部署到 Azure 应用服务

enter image description here

do we manually need to install new .net / .net sdk for an App Service in Azure using the version specific dotnet-install scripts ?

不,不需要为应用服务安装新的.net/.net sdk

正如您所提到的,使用 dotnet --info 检查 KUDU 控制台中可用的 .NET 版本。

enter image description here

enter image description here

如果您想使用 Azure App Service 中没有的任何特定版本,则可以使用 dotnet-install 脚本手动安装它。

  • 只是我们需要检查Configuration => General Settings中的版本。

enter image description here

  • 即使是我在应用服务编辑器中的 WebApplication1.runtimeconfig.json 版本也是 7.0.0

enter image description here

  • 要详细了解错误,请将 web.config 中的 stdoutLogEnabled 更新为 true,并检查 C:\home\LogFiles< 中的日志

由于应用服务的 Azure 控制台显示 Microsoft.NetCore.Appcore/Microsoft.AspNetCore.App 7.0.2.net sdk 7.0.102。 并且projectname.runtimeconfig.json 设置为 "version": "7.0.5"`,

  • 它明确指出版本 7.0.5 在 Azure 应用服务中不可用。

  • 如果您不想将应用部署为独立的,请更改 runtimeconfig.json 中的版本或从扩展安装新版本。

enter image description here

请参阅 SO 中类似类型的问题我已经解决了。

关于c# - Azure 应用服务 - .net 版本支持 - 更新(HTTP 500.31 错误)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76174107/

相关文章:

c# - 逆变值类型

javascript - Node.js http 和 bing 搜索 api

c# - Windows phone 8 数组绑定(bind)似乎没有改变

c# - 从 C# 检查 Tomcat 服务器是否已启动

c# - 将两种方法合二为一

c# - 如何在 Azure 函数中启动我的控制台应用程序可执行文件

来自 Azure SDK 的 Azure IoT deviceId 验证

c# - 由于缺少 Configuration Builder,没有 DI 无法读取 appsettings.json

c# - 将通过 HTTP 流式传输的 wav 实时转换为 mp3

c# - 从 C# 调用 C DLL 方法的正确方法