为什么Asp.Net Core 2.1 WebApi返回500.19错误? [英] Why does Asp.Net Core 2.1 WebApi return a 500.19 error?

查看:58
本文介绍了为什么Asp.Net Core 2.1 WebApi返回500.19错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小型的webapi服务,该服务可在Visual Studio下运行,但不能在IIS下运行.我做了下一个:

I have a small webapi service, which works under Visual Studio but doesn't work under IIS. I did the next:

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

当我尝试使用我的应用程序访问文件夹(例如 http://localhost/example/)时,收到 500.19 错误,代码为 0x8007000d .我读到如果 ApplicationHost.config Web.config 具有错误的XML选项,则会发生此错误.我使用VS生成的默认 Web.config 文件(我不使用 ApplicationHost.config ),但我不知道其中有什么不好.这是我的 Web.config 文件:

When I try access folder with my app (like http://localhost/example/) I receive 500.19 error with code 0x8007000d. I read this error can happen if ApplicationHost.config or Web.config has wrong XML options. I use default Web.config file (ApplicationHost.config is not used by me) which VS generate, and I don't understand what can be bad in it. Here's my Web.config file:

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

推荐答案

Lex Li写了一篇很棒的文章:

Lex Li wrote an excellent article: https://blog.lextudio.com/the-horrible-story-of-publishing-net-core-web-apps-for-beginners-6121662dd8c4, which described issues with publishing .NET Core Web Apps.

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

In my case, I hadn't installed the ASP.NET Core Hosting Bundle. A simple solution which is hard to be found because it is difficult to understand what should be searched for.

这篇关于为什么Asp.Net Core 2.1 WebApi返回500.19错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆