asp.net-core - ASP.NET Core 6 应用程序无法在 Windows 11 ARM 操作系统中的 IIS 上启动

标签 asp.net-core iis arm64 .net-6.0 windows-11

就在今天,微软发布了新的 Windows 11 ARM 更新,终于支持 IIS。理论上,这使 .NET 开发人员能够在配备 M1 芯片的较新 Macbook Pro 上完全开发 .NET 应用程序。

但是,我在让 ASP.NET Core 6 应用程序在 Windows 11 ARM 上的 IIS 中运行时遇到了麻烦。

在 IIS 中应用程序池的高级设置中,有一个新选项“在 ARM64 上启用模拟”。如果我关闭了此功能(默认设置),那么当我尝试启动应用程序时,它会停止应用程序池并在事件日志中记录此错误:

The Module DLL 'C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll' could not be loaded due to a configuration problem. The current configuration only supports loading images built for a ARM64 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349.

如果我为应用程序池启用 ARM64 模拟设置,则会在应用程序启动时收到此错误:HTTP 错误 500.30 - ASP.NET Core 应用程序无法启动。事件日志显示此错误:

Activation context generation failed for "C:\WINDOWS\system32\conhost.exe".Error in manifest or policy file "C:\WINDOWS\system32\conhost.exe" on line 0. Invalid Xml syntax.

还有其他人让他们的 ASP.NET Core 6 应用程序在 Windows ARM 环境中的 IIS 上成功运行吗?

最佳答案

我能够在配备 M1 芯片的新 Macbook Pro 上的 Windows 11 Preview for ARM 中的 IIS 下运行我的 ASP.NET 应用程序;不仅适用于 .NET 6 ASP.NET 应用程序,还适用于 ASP.NET Core 3.1 和 ASP.NET Framework 应用程序(新的 IIS 应用程序池“在 ARM64 上启用模拟”设置非常有效!) ,我不得不:

  1. 修复我的 ASP.NET Core 运行时安装。

  2. 修复我的 Windows 托管 bundle 安装。

  3. 更改我的 web.config 以以不同的方式启动 dotnet 应用程序:

    < aspNetCore processPath =“C:\Program Files\dotnet\dotnet.exe”参数=“exec“bin\Web.dll””stdoutLogEnabled =“假”hostingModel =“InProcess”>

...必须更改为:

<aspNetCore processPath="bin\Web.exe" stdoutLogEnabled="false" hostingModel="InProcess">

我认为需要进行修复,因为我最初在安装 IIS 之前安装了 ASP.NET Core 和托管 bundle (因为该操作系统尚不存在 IIS!)

2023 年更新:

如果您升级到 .NET 7 或 .NET 8 并收到可怕的“当前配置仅支持加载为 AMD64 处理器架构构建的镜像”错误,那么您需要做的就是按照ancm-arm64 github repo ,这会将您的一些 ASP.NET Core dll 替换为可在 ARM 芯片上运行的修补程序。如果任何 Microsoft 开发人员看到这篇文章,您确实应该在 ASP.NET Core 安装程序中应用此补丁。

关于asp.net-core - ASP.NET Core 6 应用程序无法在 Windows 11 ARM 操作系统中的 IIS 上启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71317484/

相关文章:

c# - 为什么 StringValues 用于 Request.Query 值?

c# - 从 ASP.NET 5 Controller VS 2015 获取 wwwroot 文件夹路径

c# - Blazor 组件 : notify of collection-changed event causing thread collisions

asp.net - 一键式网络发布时是否可以保留文件夹权限?

c# - SMTP 友好名称在 3 个不同的地方——仍然没有显示

assembly - ARM Aarch64 中的 PUSH {lr} 和 POP {lr}

arm64 上的 Linux : sendto causes "Unhandled fault: alignment fault (0x96000021)" when sending data from mmapped coherent DMA buffer

asp.net-core - 如何在 ASP.NET Core Web API 中启用 BSON 序列化?

iis - 如何修复错误 "ANCM In-Process Handler Load Failure"?

linux - 具有 arm64 架构的 QEMU 上的 Xen