HTTP 错误 500.19 - 内部服务器错误代码 0x8007000d

Höl*_*lin 4 iis-10 asp.net-core-webapi

我创建了一个 ASP.NET Core 5.0 Web API 项目。我可以在 IIS Express 中执行并运行该应用程序。如果我部署该应用程序,则会收到以下错误:

\n
Server Error in Application "application name"\nHTTP Error 500.19 \xe2\x80\x93 Internal Server Error\nHRESULT: 0x8007000d\nDescription of HRESULT\nThe requested page cannot be accessed because the related configuration data for the page is invalid.\n
Run Code Online (Sandbox Code Playgroud)\n

MS官方支持页面提到了两个原因:

\n
\n

出现此问题的原因是 ApplicationHost.config 或 Web.config\n文件包含格式错误或无法识别的 XML 元素。IIS 无法识别未安装模块的 XML 元素。例如,IIS URL 重写模块。

\n

解决

\n

使用以下方法之一:

\n
Delete the malformed XML element from the ApplicationHost.config or Web.config file.\nCheck the unidentified XML elements, and then install the relevant IIS modules.\n
Run Code Online (Sandbox Code Playgroud)\n
\n

我安装了 IIS URL 重写模块,但没有效果。\n在此输入图像描述

\n

我的 web.config 附带我的构建/部署过程。对于配置,我使用 appsettings.json。所以我不知道我的 web.config 中是否需要更改以及哪些内容需要更改。有什么建议么?

\n

...\\inetpub\\wwwroot\\MyApi\\web.config:

\n
<?xml version="1.0" encoding="utf-8"?>\n<configuration>\n  <location path="." inheritInChildApplications="false">\n    <system.webServer>\n      <handlers>\n        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />\n      </handlers>\n      <aspNetCore processPath="dotnet" arguments=".\\MyApi.dll" stdoutLogEnabled="false" stdoutLogFile=".\\logs\\stdout" hostingModel="inprocess" />\n    </system.webServer>\n  </location>\n</configuration>\n<!--ProjectGuid: f659debd-cac7-4ce5-b2fe-d1a440a87811-->\n
Run Code Online (Sandbox Code Playgroud)\n

Sae*_*udi 9

您应该安装 .Net 的托管捆绑版本以在服务器上的 IIS 中添加对 .Net core 运行时的支持

https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-5.0.13-windows-hosting-bundle-installer

所有下载: https: //dotnet.microsoft.com/en-us/download/dotnet/5.0