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

4
我创建了一个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.

官方 微软支持页面 引用了两个原因:

This problem occurs because the ApplicationHost.config or Web.config file contains a malformed or unidentified XML element. IIS can't identify the XML elements of the modules that are not installed. For example, IIS URL Rewrite module.

Resolution

Use one of the following methods:

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-->

1个回答

9

安装后出现错误变为“HTTP 错误 503。服务不可用。”有什么建议吗? - brian bentancourt

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接