【问题标题】:Why does Asp.Net Core 2.1 WebApi return a 500.19 error?为什么 Asp.Net Core 2.1 WebApi 返回 500.19 错误?
【发布时间】:2019-03-25 18:39:45
【问题描述】:

我有一个小型 webapi 服务,它可以在 Visual Studio 下工作,但不能在 IIS 下工作。 我做了下一个:

  1. 新应用程序已添加到 IIS 控制台中的默认网站。
  2. 应用程序已通过文件系统从 VS 发布到 app 文件夹 (选择了依赖框架和便携选项)。

当我尝试使用我的应用程序访问文件夹(如 http://localhost/example/)时,我收到代码为 0x8007000d500.19 错误。我读到如果 ApplicationHost.configWeb.config 有错误的 XML 选项,可能会发生此错误。我使用VS生成的默认Web.config文件(我不使用ApplicationHost.config),我不明白它有什么坏处。这是我的Web.config 文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\Service.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
    </system.webServer>
  </location>
</configuration>

【问题讨论】:

  • @LexLi,谢谢!我的问题是我没有安装 ASP.NET Core 模块。现在可以了。
  • @Miamy:请发布解决方案作为答案,并尽可能接受。否则,这个问题将无限期地留在未回答的队列中。
  • @ChrisPratt,我昨天想在睡前自己做 :)。

标签: c# iis asp.net-core-webapi


【解决方案1】:

我遇到了完全相同的问题,除了标记的正确答案之外,这对我有用:

我安装了 ASP.NET Core Hosting Bundle,但仍然收到同样的错误。

修复安装解决了我的问题。

Programs and Features -> Repair "Windows Server Hosting"

"如果 Hosting Bundle 是在 IIS 之前安装的,则必须修复 bundle 安装。安装 IIS 后再次运行 Hosting Bundle 安装程序。 如果在安装 64 位 (x64) 版本的 .NET Core 之后安装了 Hosting Bundle,则 SDK 可能会丢失(未检测到 .NET Core SDK)。要解决此问题,请参阅 ASP.NET Core 项目疑难解答。" - Install the .NET Core Hosting Bundle

【讨论】:

【解决方案2】:

Lex Li 写了一篇出色的文章:https://blog.lextudio.com/the-horrible-story-of-publishing-net-core-web-apps-for-beginners-6121662dd8c4,描述了发布 .NET Core Web 应用程序的问题。

就我而言,我没有安装 ASP.NET Core Hosting Bundle。一个很难找到的简单解决方案,因为很难理解应该搜索什么。

【讨论】:

    猜你喜欢
    • 2018-11-13
    • 2019-08-05
    • 1970-01-01
    • 2016-12-13
    • 2019-08-30
    • 2018-06-29
    • 1970-01-01
    • 2017-05-16
    • 1970-01-01
    相关资源
    最近更新 更多