在IIS上托管Web API.NET Core v2.2可以提供500

在IIS上托管Web API.NET Core v2.2可以提供500,iis,asp.net-core-webapi,asp.net-core-2.2,Iis,Asp.net Core Webapi,Asp.net Core 2.2,我正在尝试在Windows10V1903上托管基于.NETCoreV2.2构建的Web API 我已经安装了IIS,它正在运行。 我已经安装了.NETCore主机包 我已将输出从发布文件夹复制到inetpub/wwwroot下的文件夹: 我已在IIS中创建了一个网站: 该网站正在使用“无托管代码”CLR的应用程序池: 这是我的web.config: <?xml version="1.0" encoding="utf-8"?> <configuration> &l

我正在尝试在Windows10V1903上托管基于.NETCoreV2.2构建的Web API

我已经安装了IIS,它正在运行。 我已经安装了.NETCore主机包

我已将输出从发布文件夹复制到inetpub/wwwroot下的文件夹:

我已在IIS中创建了一个网站:

该网站正在使用“无托管代码”CLR的应用程序池:

这是我的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: 3840a856-efc8-4efc-b593-556179293e4e-->

有什么想法吗?

请显示完整的错误页。@LexLi使用错误页+IIS日志更新,假设您已经解决了500.19。剩下的500.0错误应该是未处理的异常,所以您需要启用特定的日志记录不,我实际上被困在这里了。我还是不知道这个应用程序出了什么问题。我甚至试着用这个模板创建一个WebAPI项目,并进行了部署,结果很好,尽管我使用的是完全相同的步骤。Nvm,我找到了原因。并不是API失败了,根本原因实际上是大摇大摆。而Swagger不起作用,因为我从未设置发布时生成XML的配置。
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2020-02-04 01:32:33
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2020-02-04 01:32:33 ::1 GET / - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 - 500 19 13 514
2020-02-04 01:32:33 ::1 GET /favicon.ico - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 http://localhost:5050/ 500 19 13 0
2020-02-04 01:32:37 ::1 GET /swagger - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 - 500 19 13 0
2020-02-04 01:32:37 ::1 GET /favicon.ico - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 http://localhost:5050/swagger 500 19 13 1
2020-02-04 01:33:02 ::1 GET /myapi/swagger - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 - 500 19 13 0
2020-02-04 01:33:02 ::1 GET /favicon.ico - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 http://localhost:5050/myapi/swagger 500 19 13 2
2020-02-04 01:33:09 ::1 GET / - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 - 500 19 13 1
2020-02-04 01:33:09 ::1 GET /favicon.ico - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 http://localhost:5050/ 500 19 13 0
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2020-02-04 02:58:25
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2020-02-04 02:58:25 ::1 GET / - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 - 500 0 0 4473
2020-02-04 02:58:29 ::1 GET /swagger - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 - 500 0 0 5
2020-02-04 02:58:37 ::1 GET /MyAPI/swagger - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 - 500 0 0 4
2020-02-04 02:58:40 ::1 GET /MyAPI - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 - 500 0 0 3
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2020-02-04 02:59:15
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2020-02-04 02:59:15 ::1 GET / - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 - 500 0 0 1340
2020-02-04 02:59:18 ::1 GET /swagger - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 - 500 0 0 4
2020-02-04 02:59:27 ::1 GET /MyAPI/swagger - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 - 500 0 0 3
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2020-02-04 03:18:09
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2020-02-04 03:18:09 ::1 GET / - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 - 500 0 0 1836
2020-02-04 03:18:12 ::1 GET /swagger - 5050 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/79.0.3945.130+Safari/537.36 - 500 0 0 5