Azure 应用服务和 IIS 上 ASP.NET Core 的常见错误参考Common errors reference for Azure App Service and IIS with ASP.NET Core

作者:Luke LathamBy Luke Latham

本主题提供在 Azure 应用服务和 IIS 上托管 ASP.NET Core 应用的常见错误的故障排除。This topic offers troubleshooting advice for common errors when hosting ASP.NET Core apps on Azure Apps Service and IIS.

收集以下信息:Collect the following information:

将错误信息与以下常见错误进行比较。Compare error information to the following common errors. 如果找到匹配项,请按照故障排除建议进行操作。If a match is found, follow the troubleshooting advice.

本主题中的错误列表并未包含所有错误。The list of errors in this topic isn't exhaustive. 如果遇到此处未列出的错误,请使用本主题底部的“内容反馈”按钮打开一个新问题,并提供有关如何重现错误的详细说明。If you encounter an error not listed here, open a new issue using the Content feedback button at the bottom of this topic with detailed instructions on how to reproduce the error.

重要

*Azure 应用服务中的 ASP.NET Core 预览版*ASP.NET Core preview releases with Azure App Service

默认情况下不会将 ASP.NET Core 预览版部署到 Azure 应用服务。ASP.NET Core preview releases aren't deployed to Azure App Service by default. 要托管使用 ASP.NET Core 预览版的应用,请参阅将 ASP.NET Core 预览版部署到 Azure 应用服务To host an app that uses an ASP.NET Core preview release, see Deploy ASP.NET Core preview release to Azure App Service.

安装程序无法获取 VC++ RedistributableInstaller unable to obtain VC++ Redistributable

  • 安装程序异常: 0x80072efd --或者-- 0x80072f76 - 未指定的错误Installer Exception: 0x80072efd --OR-- 0x80072f76 - Unspecified error

  • 安装程序日志异常†: 0x80072efd --或者-- 0x80072f76 错误:无法执行 EXE 包Installer Log Exception†: Error 0x80072efd --OR-- 0x80072f76: Failed to execute EXE package

    †此日志位于 C:\Users{USER}\AppData\Local\Temp\dd_DotNetCoreWinSvrHosting__{TIMESTAMP}.log。†The log is located at C:\Users{USER}\AppData\Local\Temp\dd_DotNetCoreWinSvrHosting__{TIMESTAMP}.log.

疑难解答:Troubleshooting:

如果在安装 .NET Core 托管捆绑包时系统无法访问 Internet,则在系统阻止安装程序获取 Microsoft Visual C++ 2015 Redistributable 时会出现此异常。If the system doesn't have Internet access while installing the .NET Core Hosting Bundle, this exception occurs when the installer is prevented from obtaining the Microsoft Visual C++ 2015 Redistributable. 可从 Microsoft 下载中心获取安装程序。Obtain an installer from the Microsoft Download Center. 如果安装程序失败,服务器可能不会收到托管依赖框架的部署 (FDD) 所需的 .NET Core 运行时。If the installer fails, the server may not receive the .NET Core runtime required to host a framework-dependent deployment (FDD). 如果托管 FDD,请在“程序和功能”或“应用和功能”中确认安装了运行时。If hosting an FDD, confirm that the runtime is installed in Programs & Features or Apps & features. 如果需要特定的运行时,请从 .NET 下载存档下载运行时并将其安装在系统上。If a specific runtime is required, download the runtime from the .NET Download Archives and install it on the system. 安装运行时后,重启系统,或通过从命令提示符依次执行 net stop was /y 和 net start w3svc 来重启 IIS。After installing the runtime, restart the system or restart IIS by executing net stop was /y followed by net start w3svc from a command prompt.

OS 升级删除了 32 位 ASP.NET Core 模块OS upgrade removed the 32-bit ASP.NET Core Module

应用程序日志: 未能加载模块 DLL C:\WINDOWS\system32\inetsrv\aspnetcore.dll。Application Log: The Module DLL C:\WINDOWS\system32\inetsrv\aspnetcore.dll failed to load. 该数据是个错误。The data is the error.

疑难解答:Troubleshooting:

OS 升级期间不会保留 C:\Windows\SysWOW64\inetsrv 目录中的非 OS 文件。Non-OS files in the C:\Windows\SysWOW64\inetsrv directory aren't preserved during an OS upgrade. 如果在 OS 升级前已安装 ASP.NET Core 模块,且随后在 OS 升级后在 32 位模式下运行任何应用池,则会遇到此问题。If the ASP.NET Core Module is installed prior to an OS upgrade and then any app pool is run in 32-bit mode after an OS upgrade, this issue is encountered. 在 OS 升级后修复 ASP.NET Core 模块。After an OS upgrade, repair the ASP.NET Core Module. 请参阅安装 .NET Core 托管捆绑包See Install the .NET Core Hosting bundle. 运行安装程序时,选择“修复”。Select Repair when the installer is run.

缺少站点扩展、安装了 32 位 (x86) 和 64 位 (x64) 站点扩展,或设置了错误的进程位数Missing site extension, 32-bit (x86) and 64-bit (x64) site extensions installed, or wrong process bitness set

适用于 Azure 应用服务托管的应用。Applies to apps hosted by Azure App Services.

  • 浏览器: HTTP 错误 500.0 - ANCM 进程内处理程序加载失败Browser: HTTP Error 500.0 - ANCM In-Process Handler Load Failure

  • 应用程序日志: 调用 hostfxr 以查找进程内请求处理程序失败,未找到任何本机依赖项。Application Log: Invoking hostfxr to find the inprocess request handler failed without finding any native dependencies. 找不到进程内请求处理程序。Could not find inprocess request handler. 调用 hostfxr 捕获的输出:无法找到任何兼容的框架版本。Captured output from invoking hostfxr: It was not possible to find any compatible framework version. 找不到指定的框架“Microsoft.AspNetCore.App”、版本“{VERSION}-preview-*”。The specified framework 'Microsoft.AspNetCore.App', version '{VERSION}-preview-*' was not found. 未能启动应用程序“/LM/W3SVC/1416782824/ROOT”,ErrorCode“0x8000ffff”。Failed to start application '/LM/W3SVC/1416782824/ROOT', ErrorCode '0x8000ffff'.

  • ASP.NET Core 模块 stdout 日志: 无法找到任何兼容的框架版本。ASP.NET Core Module stdout Log: It was not possible to find any compatible framework version. 找不到指定的框架“Microsoft.AspNetCore.App”、版本“{VERSION}-preview-*”。The specified framework 'Microsoft.AspNetCore.App', version '{VERSION}-preview-*' was not found.

  • ASP.NET Core 模块调试日志: 调用 hostfxr 以查找进程内请求处理程序失败,未找到任何本机依赖项。ASP.NET Core Module Debug Log: Invoking hostfxr to find the inprocess request handler failed without finding any native dependencies. 这很可能意味着应用配置错误,请检查 Microsoft.NetCore.App 和 Microsoft.AspNetCore.App 版本是否针对该应用程序并安装在计算机上。This most likely means the app is misconfigured, please check the versions of Microsoft.NetCore.App and Microsoft.AspNetCore.App that are targeted by the application and are installed on the machine. 返回失败的 HRESULT:0x8000ffff。Failed HRESULT returned: 0x8000ffff. 找不到进程内请求处理程序。Could not find inprocess request handler. 无法找到任何兼容的框架版本。It was not possible to find any compatible framework version. 找不到指定的框架“Microsoft.AspNetCore.App”、版本“{VERSION}-preview-*”。The specified framework 'Microsoft.AspNetCore.App', version '{VERSION}-preview-*' was not found.

疑难解答:Troubleshooting:

  • 如果在预览运行时运行该应用,请安装 32 位 (x86) 或 64位 (x64) 站点扩展,以匹配应用的位数和应用的运行时版本。If running the app on a preview runtime, install either the 32-bit (x86) or 64-bit (x64) site extension that matches the bitness of the app and the app's runtime version. 请勿同时安装扩展或扩展的多个运行时版本。Don't install both extensions or multiple runtime versions of the extension.

    • ASP.NET Core {RUNTIME VERSION} (x86) 运行时ASP.NET Core {RUNTIME VERSION} (x86) Runtime
    • ASP.NET Core {RUNTIME VERSION} (x64) 运行时ASP.NET Core {RUNTIME VERSION} (x64) Runtime

    重新启动应用。Restart the app. 等待几秒钟,以便应用重新启动。Wait several seconds for the app to restart.

  • 如果在预览运行时运行应用,且同时安装了 32 位 (x86) 和 64 位 (x64) 站点扩展,请卸载与应用的位数不匹配的站点扩展。If running the app on a preview runtime and both the 32-bit (x86) and 64-bit (x64) site extensions are installed, uninstall the site extension that doesn't match the bitness of the app. 删除站点扩展之后,重新启动应用。After removing the site extension, restart the app. 等待几秒钟,以便应用重新启动。Wait several seconds for the app to restart.

  • 如果在预览运行时运行该应用,并且站点扩展的位数匹配应用的位数,请确认预览站点扩展的运行时版本匹配应用的运行时版本。If running the app on a preview runtime and the site extension's bitness matches that of the app, confirm that the preview site extension's runtime version matches the app's runtime version.

  • 确认“应用程序设置”中的应用“平台”与应用的位数匹配。Confirm that the app's Platform in Application Settings matches the bitness of the app.

有关更多信息,请参见将 ASP.NET Core 应用部署到 Azure 应用服务For more information, see 将 ASP.NET Core 应用部署到 Azure 应用服务.

已部署 x86 应用,但 32 位应用未启用应用池An x86 app is deployed but the app pool isn't enabled for 32-bit apps

  • 浏览器: HTTP 错误 500.30 - ANCM 进程内启动失败Browser: HTTP Error 500.30 - ANCM In-Process Start Failure

  • 应用程序日志: 物理根路径为 '{PATH}' 的应用程序 '/LM/W3SVC/5/ROOT' 遇到意外的托管异常,异常代码= '0xe0434352'。Application Log: Application '/LM/W3SVC/5/ROOT' with physical root '{PATH}' hit unexpected managed exception, exception code = '0xe0434352'. 请检查 stderr 日志以获取详细信息。Please check the stderr logs for more information. 物理根路径为 '{PATH}' 的应用程序 '/LM/W3SVC/5/ROOT' 未能加载 clr 和托管应用程序。Application '/LM/W3SVC/5/ROOT' with physical root '{PATH}' failed to load clr and managed application. CLR 工作线程提前退出CLR worker thread exited prematurely

  • ASP.NET Core 模块 stdout 日志: 日志文件已创建,但为空。ASP.NET Core Module stdout Log: The log file is created but empty.

  • ASP.NET Core 模块调试日志: 返回失败的 HRESULT:0x8007023eASP.NET Core Module Debug Log: Failed HRESULT returned: 0x8007023e

发布自包含应用时,SDK 会捕获此方案。This scenario is trapped by the SDK when publishing a self-contained app. 如果 RID 与平台目标(例如,win10-x64 RID 与项目文件中的 <PlatformTarget>x86</PlatformTarget>)不匹配,则 SDK 会产生错误。The SDK produces an error if the RID doesn't match the platform target (for example, win10-x64 RID with <PlatformTarget>x86</PlatformTarget> in the project file).

疑难解答:Troubleshooting:

对于依赖 x86 框架的部署 (<PlatformTarget>x86</PlatformTarget>),请为 32 位应用启用 IIS 应用池。For an x86 framework-dependent deployment (<PlatformTarget>x86</PlatformTarget>), enable the IIS app pool for 32-bit apps. 在 IIS 管理器中,打开应用池的“高级设置”并将“启用 32 位应用程序”设置为 True。In IIS Manager, open the app pool's Advanced Settings and set Enable 32-Bit Applications to True.

平台与 RID 冲突Platform conflicts with RID

  • 浏览器: HTTP 错误 502.5 - 进程失败Browser: HTTP Error 502.5 - Process Failure

  • 应用程序日志: 物理根路径为 'C:{PATH}' 的应用程序 'MACHINE/WEBROOT/APPHOST/{ASSEMBLY}' 未能通过 '"C:{PATH}{ASSEMBLY}.{exe|dll}" ' 命令行启动进程,ErrorCode = '0x80004005 : ff。Application Log: Application 'MACHINE/WEBROOT/APPHOST/{ASSEMBLY}' with physical root 'C:{PATH}' failed to start process with commandline '"C:{PATH}{ASSEMBLY}.{exe|dll}" ', ErrorCode = '0x80004005 : ff.

  • ASP.NET Core 模块 stdout 日志: 未经处理的异常:System.BadImageFormatException:无法加载文件或程序集 '{ASSEMBLY}.dll'。ASP.NET Core Module stdout Log: Unhandled Exception: System.BadImageFormatException: Could not load file or assembly '{ASSEMBLY}.dll'. 试图加载的程序的格式不正确。An attempt was made to load a program with an incorrect format.

疑难解答:Troubleshooting:

  • 确认应用在 Kestrel 上本地运行。Confirm that the app runs locally on Kestrel. 进程失败可能是由应用的内部问题导致的。A process failure might be the result of a problem within the app. 有关详细信息,请参阅疑难解答 (IIS)疑难解答(Azure 应用服务)For more information, see Troubleshoot (IIS) or Troubleshoot (Azure App Service).

  • 如果在升级应用和部署更新的程序集时,Azure 应用部署出现此异常,请从先前的部署中手动删除所有文件。If this exception occurs for an Azure Apps deployment when upgrading an app and deploying newer assemblies, manually delete all files from the prior deployment. 部署升级的应用时,延迟的不兼容程序集可能造成 System.BadImageFormatException 异常。Lingering incompatible assemblies can result in a System.BadImageFormatException exception when deploying an upgraded app.

URI 终结点错误或网站已停止URI endpoint wrong or stopped website

  • 浏览器: ERR_CONNECTION_REFUSED --或者-- 无法连接Browser: ERR_CONNECTION_REFUSED --OR-- Unable to connect

  • 应用程序日志: 没有条目Application Log: No entry

  • ASP.NET Core 模块 stdout 日志: 未创建日志文件。ASP.NET Core Module stdout Log: The log file isn't created.

  • ASP.NET Core 模块调试日志: 未创建日志文件。ASP.NET Core Module Debug Log: The log file isn't created.

疑难解答:Troubleshooting:

  • 确认正在使用的应用的 URI 端点是否正确。Confirm the correct URI endpoint for the app is in use. 检查绑定。Check the bindings.

  • 确认 IIS 网站未处于“已停止”状态。Confirm that the IIS website isn't in the Stopped state.

已禁用 CoreWebEngine 或 W3SVC 服务器功能CoreWebEngine or W3SVC server features disabled

OS 异常: 必须安装 IIS 7.0 CoreWebEngine 和 W3SVC 功能才能使用 ASP.NET Core 模块。OS Exception: The IIS 7.0 CoreWebEngine and W3SVC features must be installed to use the ASP.NET Core Module.

疑难解答:Troubleshooting:

确认启用了适当的角色和功能。Confirm that the proper role and features are enabled. 请参阅 IIS 配置See IIS Configuration.

网站物理路径不正确或缺少应用Incorrect website physical path or app missing

  • 浏览器: 403 禁止访问 - 访问被拒绝 --或者-- 403.14 禁止访问 - Web 服务器被配置为不列出此目录的内容。Browser: 403 Forbidden - Access is denied --OR-- 403.14 Forbidden - The Web server is configured to not list the contents of this directory.

  • 应用程序日志: 没有条目Application Log: No entry

  • ASP.NET Core 模块 stdout 日志: 未创建日志文件。ASP.NET Core Module stdout Log: The log file isn't created.

  • ASP.NET Core 模块调试日志: 未创建日志文件。ASP.NET Core Module Debug Log: The log file isn't created.

疑难解答:Troubleshooting:

检查 IIS 网站的“基本设置”和物理应用文件夹。Check the IIS website Basic Settings and the physical app folder. 确认应用所在的文件夹位于 IIS 网站的物理路径中。Confirm that the app is in the folder at the IIS website Physical path.

角色不正确、未安装 ASP.NET Core 模块或权限不正确Incorrect role, ASP.NET Core Module not installed, or incorrect permissions

  • 浏览器: 500.19 内部服务器错误 - 无法访问请求的页面,因为该页面的相关配置数据无效。Browser: 500.19 Internal Server Error - The requested page cannot be accessed because the related configuration data for the page is invalid. --或者-- 无法显示此页面--OR-- This page can't be displayed

  • 应用程序日志: 没有条目Application Log: No entry

  • ASP.NET Core 模块 stdout 日志: 未创建日志文件。ASP.NET Core Module stdout Log: The log file isn't created.

  • ASP.NET Core 模块调试日志: 未创建日志文件。ASP.NET Core Module Debug Log: The log file isn't created.

疑难解答:Troubleshooting:

  • 确认启用了适当的角色。Confirm that the proper role is enabled. 请参阅 IIS 配置See IIS Configuration.

  • 打开“程序和功能”或“应用和功能”,然后确认是否安装了 Windows Server Hosting。Open Programs & Features or Apps & features and confirm that Windows Server Hosting is installed. 如果已安装的程序列表中没有 Windows Server Hosting,请下载并安装 .NET Core 托管捆绑包。If Windows Server Hosting isn't present in the list of installed programs, download and install the .NET Core Hosting Bundle.

    当前 .NET Core 托管捆绑包安装程序(直接下载)Current .NET Core Hosting Bundle installer (direct download)

    有关详细信息,请参阅安装 .NET Core 托管捆绑包For more information, see Install the .NET Core Hosting Bundle.

  • 请确保将“应用程序池” > “进程模型” > “标识”设置为 ApplicationPoolIdentity,或确保自定义标识具有访问应用部署文件夹的相应权限。Make sure that the Application Pool > Process Model > Identity is set to ApplicationPoolIdentity or the custom identity has the correct permissions to access the app's deployment folder.

  • 如果卸载了 ASP.NET Core 托管捆绑包并已安装了一个早期版本的托管捆绑包,则 applicationHost.config 文件将不包含 ASP.NET Core 模块分区。If you uninstalled the ASP.NET Core Hosting Bundle and installed an earlier version of the hosting bundle, the applicationHost.config file doesn't include a section for the ASP.NET Core Module. 可打开 %windir%/System32/inetsrv/config 处的 applicationHost.config 文件并找到 <configuration><configSections><sectionGroup name="system.webServer"> 分区组。Open applicationHost.config at %windir%/System32/inetsrv/config and find the <configuration><configSections><sectionGroup name="system.webServer"> section group. 如果分区组中缺少 ASP.NET Core 模块分区,请添加以下分区元素:If the section for the ASP.NET Core Module is missing from the section group, add the section element:

    <section name="aspNetCore" overrideModeDefault="Allow" />
    

    或者,安装最新版本的 ASP.NET Core 托管捆绑包。Alternatively, install the latest version of the ASP.NET Core Hosting Bundle. 最新版本与受支持的 ASP.NET Core 应用向后兼容。The latest version is backwards-compatible with supported ASP.NET Core apps.

processPath 不正确、缺少 PATH 变量、未安装托管捆绑包、未重启系统/IIS、未安装 VC++ Redistributable 或 dotnet.exe 访问冲突Incorrect processPath, missing PATH variable, Hosting Bundle not installed, system/IIS not restarted, VC++ Redistributable not installed, or dotnet.exe access violation

  • 浏览器: HTTP 错误 500.0 - ANCM 进程内处理程序加载失败Browser: HTTP Error 500.0 - ANCM In-Process Handler Load Failure

  • 应用程序日志: 物理根路径为 'C:{PATH}' 的应用程序 'MACHINE/WEBROOT/APPHOST/{ASSEMBLY}' 未能通过 '"{...}" ' 命令行启动进程Application Log: Application 'MACHINE/WEBROOT/APPHOST/{ASSEMBLY}' with physical root 'C:{PATH}' failed to start process with commandline '"{...}" ,ErrorCode = '0x80070002 :0。', ErrorCode = '0x80070002 : 0. 应用程序 '{PATH}' 无法启动。Application '{PATH}' wasn't able to start. '{PATH}' 中未找到可执行文件。Executable was not found at '{PATH}'. 未能启动应用程序 '/LM/W3SVC/2/ROOT',ErrorCode '0x8007023e'。Failed to start application '/LM/W3SVC/2/ROOT', ErrorCode '0x8007023e'.

  • ASP.NET Core 模块 stdout 日志: 未创建日志文件。ASP.NET Core Module stdout Log: The log file isn't created.

  • ASP.NET Core 模块调试日志: 事件日志:应用程序 '{PATH}' 无法启动。ASP.NET Core Module Debug Log: Event Log: 'Application '{PATH}' wasn't able to start. '{PATH}' 中未找到可执行文件。Executable was not found at '{PATH}'. 返回失败的 HRESULT:0x8007023eFailed HRESULT returned: 0x8007023e

  • 浏览器: HTTP 错误 502.5 - 进程失败Browser: HTTP Error 502.5 - Process Failure

  • 应用程序日志: 物理根路径为 'C:{PATH}' 的应用程序 'MACHINE/WEBROOT/APPHOST/{ASSEMBLY}' 未能通过 '"{...}" ' 命令行启动进程Application Log: Application 'MACHINE/WEBROOT/APPHOST/{ASSEMBLY}' with physical root 'C:{PATH}' failed to start process with commandline '"{...}" ,ErrorCode = '0x80070002 :0。', ErrorCode = '0x80070002 : 0.

  • ASP.NET Core 模块 stdout 日志: 日志文件已创建,但为空。ASP.NET Core Module stdout Log: The log file is created but empty.

疑难解答:Troubleshooting:

  • 确认应用在 Kestrel 上本地运行。Confirm that the app runs locally on Kestrel. 进程失败可能是由应用的内部问题导致的。A process failure might be the result of a problem within the app. 有关详细信息,请参阅疑难解答 (IIS)疑难解答(Azure 应用服务)For more information, see Troubleshoot (IIS) or Troubleshoot (Azure App Service).

  • 检查 web.config 中 <aspNetCore> 元素的 processPath 属性,对于依赖框架的部署 (FDD),确保它为 dotnet,对于独立部署 (SCD),确保它为 .\{ASSEMBLY}.exeCheck the processPath attribute on the <aspNetCore> element in web.config to confirm that it's dotnet for a framework-dependent deployment (FDD) or .\{ASSEMBLY}.exe for a self-contained deployment (SCD).

  • 对于 FDD,可能无法通过路径设置访问 dotnet.exe。For an FDD, dotnet.exe might not be accessible via the PATH settings. 确认“系统路径”设置中存在“C:\Program Files\dotnet”\。Confirm that C:\Program Files\dotnet\ exists in the System PATH settings.

  • 对于 FDD,应用池的用户标识可能无法访问 dotnet.exe。For an FDD, dotnet.exe might not be accessible for the user identity of the app pool. 确认应用池用户标识具有访问 C:\Program Files\dotnet 目录的权限。Confirm that the app pool user identity has access to the C:\Program Files\dotnet directory. 确认没有为应用池用户标识配置针对 C:\Program Files\dotnet 和应用目录的拒绝规则。Confirm that there are no deny rules configured for the app pool user identity on the C:\Program Files\dotnet and app directories.

  • 可能已部署 FDD 并安装了 .NET Core,但未重启 IIS。An FDD may have been deployed and .NET Core installed without restarting IIS. 重启服务器,或通过从命令提示符依次执行 net stop was /y 和 net start w3svc 来重启 IIS。Either restart the server or restart IIS by executing net stop was /y followed by net start w3svc from a command prompt.

  • 可能已部署 FDD,但未在托管系统上安装 .NET Core 运行时。An FDD may have been deployed without installing the .NET Core runtime on the hosting system. 如果尚未安装 .NET Core 运行时,则运行系统上的 .NET Core 托管捆绑包安装程序If the .NET Core runtime hasn't been installed, run the .NET Core Hosting Bundle installer on the system.

    当前 .NET Core 托管捆绑包安装程序(直接下载)Current .NET Core Hosting Bundle installer (direct download)

    有关详细信息,请参阅安装 .NET Core 托管捆绑包For more information, see Install the .NET Core Hosting Bundle.

    如果需要特定的运行时,请从 .NET 下载存档下载运行时并将其安装在系统上。If a specific runtime is required, download the runtime from the .NET Download Archives and install it on the system. 重启系统,或通过从命令提示符依次执行 net stop was /y 和 net start w3svc 来重启 IIS,完成安装。Complete the installation by restarting the system or restarting IIS by executing net stop was /y followed by net start w3svc from a command prompt.

  • 可能已部署 FDD,但系统上未安装 Microsoft Visual C++ 2015 Redistributable (x64)。An FDD may have been deployed and the Microsoft Visual C++ 2015 Redistributable (x64) isn't installed on the system. 可从 Microsoft 下载中心获取安装程序。Obtain an installer from the Microsoft Download Center.

<aspNetCore> 元素的参数不正确Incorrect arguments of <aspNetCore> element

  • 浏览器: HTTP 错误 500.0 - ANCM 进程内处理程序加载失败Browser: HTTP Error 500.0 - ANCM In-Process Handler Load Failure

  • 应用程序日志: 调用 hostfxr 以查找进程内请求处理程序失败,未找到任何本机依赖项。Application Log: Invoking hostfxr to find the inprocess request handler failed without finding any native dependencies. 这很可能意味着应用配置错误,请检查 Microsoft.NetCore.App 和 Microsoft.AspNetCore.App 版本是否针对该应用程序并安装在计算机上。This most likely means the app is misconfigured, please check the versions of Microsoft.NetCore.App and Microsoft.AspNetCore.App that are targeted by the application and are installed on the machine. 找不到进程内请求处理程序。Could not find inprocess request handler. 调用 hostfxr 捕获的输出:是否希望运行 dotnet SDK 命令?Captured output from invoking hostfxr: Did you mean to run dotnet SDK commands? 请从以下位置安装 dotnet SDK: https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 未能启动应用程序 '/LM/W3SVC/3/ROOT',ErrorCode '0x8000ffff'。Please install dotnet SDK from: https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 Failed to start application '/LM/W3SVC/3/ROOT', ErrorCode '0x8000ffff'.

  • ASP.NET Core 模块 stdout 日志: 是否希望运行 dotnet SDK 命令?ASP.NET Core Module stdout Log: Did you mean to run dotnet SDK commands? 请从以下位置安装 dotnet SDK: https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409Please install dotnet SDK from: https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409

  • ASP.NET Core 模块调试日志: 调用 hostfxr 以查找进程内请求处理程序失败,未找到任何本机依赖项。ASP.NET Core Module Debug Log: Invoking hostfxr to find the inprocess request handler failed without finding any native dependencies. 这很可能意味着应用配置错误,请检查 Microsoft.NetCore.App 和 Microsoft.AspNetCore.App 版本是否针对该应用程序并安装在计算机上。This most likely means the app is misconfigured, please check the versions of Microsoft.NetCore.App and Microsoft.AspNetCore.App that are targeted by the application and are installed on the machine. 返回失败的 HRESULT:0x8000ffff 找不到进程内请求处理程序。Failed HRESULT returned: 0x8000ffff Could not find inprocess request handler. 调用 hostfxr 捕获的输出:是否希望运行 dotnet SDK 命令?Captured output from invoking hostfxr: Did you mean to run dotnet SDK commands? 请从以下位置安装 dotnet SDK: https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 返回失败的 HRESULT:0x8000ffffPlease install dotnet SDK from: https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 Failed HRESULT returned: 0x8000ffff

  • 浏览器: HTTP 错误 502.5 - 进程失败Browser: HTTP Error 502.5 - Process Failure

  • 应用程序日志: 物理根路径为 'C:{PATH}' 的应用程序 'MACHINE/WEBROOT/APPHOST/{ASSEMBLY}' 未能通过 '"dotnet" .{ASSEMBLY}.dll' 命令行启动进程,ErrorCode = '0x80004005 :80008081。Application Log: Application 'MACHINE/WEBROOT/APPHOST/{ASSEMBLY}' with physical root 'C:{PATH}' failed to start process with commandline '"dotnet" .{ASSEMBLY}.dll', ErrorCode = '0x80004005 : 80008081.

  • ASP.NET Core 模块 stdout 日志: 要执行的应用程序不存在:'PATH{ASSEMBLY}.dll'ASP.NET Core Module stdout Log: The application to execute does not exist: 'PATH{ASSEMBLY}.dll'

疑难解答:Troubleshooting:

  • 确认应用在 Kestrel 上本地运行。Confirm that the app runs locally on Kestrel. 进程失败可能是由应用的内部问题导致的。A process failure might be the result of a problem within the app. 有关详细信息,请参阅疑难解答 (IIS)疑难解答(Azure 应用服务)For more information, see Troubleshoot (IIS) or Troubleshoot (Azure App Service).

  • 检查 web.config 中 <aspNetCore> 元素的 arguments 属性,确认该属性:(a) 对于依赖框架的部署 (FDD) 为 .\{ASSEMBLY}.dll;或 (b) 对于独立部署 (SCD),则为不存在、为空字符串 (arguments=""),或为应用参数列表 (arguments="{ARGUMENT_1}, {ARGUMENT_2}, ... {ARGUMENT_X}")。Examine the arguments attribute on the <aspNetCore> element in web.config to confirm that it's either (a) .\{ASSEMBLY}.dll for a framework-dependent deployment (FDD); or (b) not present, an empty string (arguments=""), or a list of the app's arguments (arguments="{ARGUMENT_1}, {ARGUMENT_2}, ... {ARGUMENT_X}") for a self-contained deployment (SCD).

缺少 .NET Core 共享框架Missing .NET Core shared framework

  • 浏览器: HTTP 错误 500.0 - ANCM 进程内处理程序加载失败Browser: HTTP Error 500.0 - ANCM In-Process Handler Load Failure

  • 应用程序日志: 调用 hostfxr 以查找进程内请求处理程序失败,未找到任何本机依赖项。Application Log: Invoking hostfxr to find the inprocess request handler failed without finding any native dependencies. 这很可能意味着应用配置错误,请检查 Microsoft.NetCore.App 和 Microsoft.AspNetCore.App 版本是否针对该应用程序并安装在计算机上。This most likely means the app is misconfigured, please check the versions of Microsoft.NetCore.App and Microsoft.AspNetCore.App that are targeted by the application and are installed on the machine. 找不到进程内请求处理程序。Could not find inprocess request handler. 调用 hostfxr 捕获的输出:无法找到任何兼容的框架版本。Captured output from invoking hostfxr: It was not possible to find any compatible framework version. 找不到指定的框架 'Microsoft.AspNetCore.App'、版本 '{VERSION}'。The specified framework 'Microsoft.AspNetCore.App', version '{VERSION}' was not found.

未能启动应用程序 '/LM/W3SVC/5/ROOT',ErrorCode '0x8000ffff'。Failed to start application '/LM/W3SVC/5/ROOT', ErrorCode '0x8000ffff'.

  • ASP.NET Core 模块 stdout 日志: 无法找到任何兼容的框架版本。ASP.NET Core Module stdout Log: It was not possible to find any compatible framework version. 找不到指定的框架 'Microsoft.AspNetCore.App'、版本 '{VERSION}'。The specified framework 'Microsoft.AspNetCore.App', version '{VERSION}' was not found.

  • ASP.NET Core 模块调试日志: 返回失败的 HRESULT:0x8000ffffASP.NET Core Module Debug Log: Failed HRESULT returned: 0x8000ffff

疑难解答:Troubleshooting:

对于依赖框架的部署 (FDD),确认已在系统上安装正确的运行时。For a framework-dependent deployment (FDD), confirm that the correct runtime installed on the system.

应用程序池已停止Stopped Application Pool

  • 浏览器: 503 服务不可用Browser: 503 Service Unavailable

  • 应用程序日志: 没有条目Application Log: No entry

  • ASP.NET Core 模块 stdout 日志: 未创建日志文件。ASP.NET Core Module stdout Log: The log file isn't created.

  • ASP.NET Core 模块调试日志: 未创建日志文件。ASP.NET Core Module Debug Log: The log file isn't created.

疑难解答:Troubleshooting:

确认应用程序池未处于“已停止”状态。Confirm that the Application Pool isn't in the Stopped state.

子应用程序包括 <handlers> 部分Sub-application includes a <handlers> section

  • 浏览器: HTTP 错误 500.19 - 内部服务器错误Browser: HTTP Error 500.19 - Internal Server Error

  • 应用程序日志: 没有条目Application Log: No entry

  • ASP.NET Core 模块 stdout 日志: 创建根应用的日志文件并显示正常操作。ASP.NET Core Module stdout Log: The root app's log file is created and shows normal operation. 未创建子应用的日志文件。The sub-app's log file isn't created.

  • ASP.NET Core 模块调试日志: 创建根应用的日志文件并显示正常操作。ASP.NET Core Module Debug Log: The root app's log file is created and shows normal operation. 未创建子应用的日志文件。The sub-app's log file isn't created.

疑难解答:Troubleshooting:

确认子应用的 web.config 文件不包含 <handlers> 部分,或者子应用未继承父级应用的处理程序。Confirm that the sub-app's web.config file doesn't include a <handlers> section or that the sub-app doesn't inherit the parent app's handlers.

父级应用的 web.config 的<system.webServer> 放在 <location> 元素内。The parent app's <system.webServer> section of web.config is placed inside of a <location> element. InheritInChildApplications 属性设置为 false,表示 <location> 元素中指定的设置不会由驻留在父级应用子目录中的应用继承。The InheritInChildApplications property is set to false to indicate that the settings specified within the <location> element aren't inherited by apps that reside in a subdirectory of the parent app. 有关更多信息,请参见ASP.NET Core 模块For more information, see ASP.NET Core 模块.

确认子应用的 web.config 文件不包括 <handlers> 部分。Confirm that the sub-app's web.config file doesn't include a <handlers> section.

stdout 日志路径不正确stdout log path incorrect

  • 浏览器: 应用正常响应。Browser: The app responds normally.
  • 应用程序日志: 无法在 C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll 中启动 stdout 重定向。Application Log: Could not start stdout redirection in C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll. 异常消息:在 {PATH}\aspnetcoremodulev2\commonlib\fileoutputmanager.cpp:84 返回了 HRESULT 0x80070005。Exception message: HRESULT 0x80070005 returned at {PATH}\aspnetcoremodulev2\commonlib\fileoutputmanager.cpp:84. 无法在 C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll 中停止 stdout 重定向。Could not stop stdout redirection in C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll. 异常消息:在 {PATH} 返回了 HRESULT 0x80070002。Exception message: HRESULT 0x80070002 returned at {PATH}. 无法在 {PATH}\aspnetcorev2_inprocess.dll 中启动 stdout 重定向。Could not start stdout redirection in {PATH}\aspnetcorev2_inprocess.dll.

  • ASP.NET Core 模块 stdout 日志: 未创建日志文件。ASP.NET Core Module stdout Log: The log file isn't created.

  • ASP.NET Core 模块调试日志: 无法在 C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll 中启动 stdout 重定向。ASP.NET Core Module debug Log: Could not start stdout redirection in C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll. 异常消息:在 {PATH}\aspnetcoremodulev2\commonlib\fileoutputmanager.cpp:84 返回了 HRESULT 0x80070005。Exception message: HRESULT 0x80070005 returned at {PATH}\aspnetcoremodulev2\commonlib\fileoutputmanager.cpp:84. 无法在 C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll 中停止 stdout 重定向。Could not stop stdout redirection in C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll. 异常消息:在 {PATH} 返回了 HRESULT 0x80070002。Exception message: HRESULT 0x80070002 returned at {PATH}. 无法在 {PATH}\aspnetcorev2_inprocess.dll 中启动 stdout 重定向。Could not start stdout redirection in {PATH}\aspnetcorev2_inprocess.dll.

  • 应用程序日志: 警告:无法创建 stdoutLogFile \?{PATH}\path_doesnt_exist\stdout_{PROCESS ID}{TIMESTAMP}.log,ErrorCode = -2147024893。Application Log: Warning: Could not create stdoutLogFile \?{PATH}\path_doesnt_exist\stdout{PROCESS ID}_{TIMESTAMP}.log, ErrorCode = -2147024893.

  • ASP.NET Core 模块 stdout 日志: 未创建日志文件。ASP.NET Core Module stdout Log: The log file isn't created.

疑难解答:Troubleshooting:

应用程序配置常见问题Application configuration general issue

  • 浏览器: HTTP 错误 500.0 - ANCM 进程内处理程序加载失败 --或者-- HTTP 错误 500.30 - ANCM 进程内启动失败Browser: HTTP Error 500.0 - ANCM In-Process Handler Load Failure --OR-- HTTP Error 500.30 - ANCM In-Process Start Failure

  • 应用程序日志: 变量Application Log: Variable

  • ASP.NET Core 模块 stdout 日志: 日志文件已创建,但为空或使用常规条目创建,直到应用失败。ASP.NET Core Module stdout Log: The log file is created but empty or created with normal entries until the point of the app failing.

  • ASP.NET Core 模块调试日志: 变量ASP.NET Core Module Debug Log: Variable

  • 浏览器: HTTP 错误 502.5 - 进程失败Browser: HTTP Error 502.5 - Process Failure

  • 应用程序日志: 物理根路径为 'C:{PATH}' 的应用程序 'MACHINE/WEBROOT/APPHOST/{ASSEMBLY}' 通过 '"C:{PATH}{ASSEMBLY}.{exe|dll}" ' 命令行创建了进程,但该进程出现故障、未响应或未在给定的端口 '{PORT}' 上侦听,ErrorCode = '{ERROR CODE}'Application Log: Application 'MACHINE/WEBROOT/APPHOST/{ASSEMBLY}' with physical root 'C:{PATH}' created process with commandline '"C:{PATH}{ASSEMBLY}.{exe|dll}" ' but either crashed or did not respond or did not listen on the given port '{PORT}', ErrorCode = '{ERROR CODE}'

  • ASP.NET Core 模块 stdout 日志: 日志文件已创建,但为空。ASP.NET Core Module stdout Log: The log file is created but empty.

疑难解答:Troubleshooting:

此进程无法启动,这很可能是由应用配置或编程问题引起的。The process failed to start, most likely due to an app configuration or programming issue.

有关详细信息,请参阅下列主题:For more information, see the following topics: