如何修复IIS中部署ASP.NET Core+Angular项目时的500.19错误
解决ASP.NET Core 5 + Angular 15 IIS部署0x8007000d错误方案
错误码0x8007000d属于IIS配置解析错误,核心原因是无法识别web.config中的ASP.NET Core模块或缺少必要依赖组件,以下是针对性解决方案:
安装ASP.NET Core 5 Hosting Bundle
这是IIS托管ASP.NET Core应用的必备组件,包含AspNetCoreModuleV2和.NET Core 5运行时。安装完成后执行命令iisreset重启IIS,必要时重启服务器确保组件生效。补全Windows功能配置
打开「启用或关闭Windows功能」,确保勾选以下组件:- Internet Information Services -> Web Management Tools -> IIS管理控制台
- Internet Information Services -> World Wide Web Services -> Application Development Features -> .NET Extensibility 4.8
- Internet Information Services -> World Wide Web Services -> Application Development Features -> ASP.NET 4.8
- Internet Information Services -> World Wide Web Services -> Application Development Features -> CGI
确认所有ASP相关组件无遗漏,保存后重启IIS。
修正web.config配置
- 检查
processPath和arguments:确认发布文件夹中存在serverApi.dll,可改用绝对路径避免相对路径问题,例如processPath="C:\Program Files\dotnet\dotnet.exe",arguments="C:\publish\serverApi.dll"。 - 切换托管模式:将
hostingModel改为outofprocess,同时开启日志排查问题,修改后的配置段如下:
手动创建<aspNetCore processPath="dotnet" arguments=".\serverApi.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="outofprocess" />logs文件夹,查看生成的日志文件获取具体错误信息。
- 检查
调整网站权限
右键IIS中的目标网站,选择「编辑权限」-「安全」,确保IIS_IUSRS、IUSR用户以及应用程序池身份(如AppPoolIdentity)对发布文件夹拥有读取和执行权限。验证.NET Core运行时
打开命令提示符执行dotnet --list-runtimes,确认输出中包含Microsoft.AspNetCore.App 5.0.x版本的运行时,若缺失需重新安装对应版本的.NET Core运行时。
内容的提问来源于stack exchange,提问作者R. Nourmandi
相关产品推荐
相关产品推荐

