【问题标题】:HTTP Error 500.19 - internal server error code 0x8007000dHTTP 错误 500.19 - 内部服务器错误代码 0x8007000d
【发布时间】:2022-01-14 23:56:34
【问题描述】:

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

Server Error in Application "application name"
HTTP Error 500.19 – Internal Server Error
HRESULT: 0x8007000d
Description of HRESULT
The requested page cannot be accessed because the related configuration data for the page is invalid.

官方MS support page引用了两个原因:

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

分辨率

使用以下方法之一:

Delete the malformed XML element from the ApplicationHost.config or Web.config file.
Check the unidentified XML elements, and then install the relevant IIS modules.

我安装了 IIS URL Rewrite 模块没有效果。

我的 web.config 随我的构建/部署过程一起提供。对于配置,我使用 appsettings.json。所以我不知道我的 web.config 是否以及有什么可能发生变化。有什么建议吗?

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

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

【问题讨论】:

标签: asp.net-core-webapi iis-10


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2015-05-16
    • 2021-05-09
    • 1970-01-01
    • 2020-08-19
    • 1970-01-01
    • 2021-10-18
    • 1970-01-01
    • 2019-09-06
    相关资源
    最近更新 更多