";500-在Windows服务器上调用ASP.NET Core 2.1 Web API时出现内部服务器错误"; [英] "500 - Internal server error" when calling ASP.NET Core 2.1 Web API on Windows Server
问题描述
我有一个ASP.Net Core 2.1 Web API,我已经将其部署到我们最近购买的一台新服务器上(运行Windows Server 2016 Standard)。API在我的开发PC和我们的旧服务器(运行Windows Server 2012 R2)上都能完美运行。但在这台新服务器上,我收到以下错误:
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
我记得一年前,为了让它在我们的旧服务器上运行,我也费了很大劲。我最终还是让它起作用了,但是我不记得我做了什么!有没有办法获得有关此错误的更多信息?我已经检查了新服务器上的Windows事件查看器,但没有任何内容。另外,虽然我的web.config中有stdoutLogEnabled=";true";,但它没有生成日志-而且我已经创建了logsstdout路径,因此文件夹确实存在.
我的Startup.cs中也有app.UseDeveloperExceptionPage();,但我没有得到任何有关简单的500内部服务器错误的更多信息。
我的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=".PropWorx.API.dll" stdoutLogEnabled="true" stdoutLogFile=".logsstdout" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: cfa62a1f-c5f6-43f8-bcbe-04068e40b803-->
我还安装了Microsoft.NET Core 2.1.1-Windows Server Hosted和Microsoft.NET Core Runtime-2.1.1(x86和x64)。
就像我说的,它在我的开发PC和我们的旧服务器上都可以工作,所以它一定是新服务器上的配置问题。除了500个内部服务器错误之外,是否还有其他方法可以获取更详细的错误信息?
推荐答案
我有一个过期版本的.NET Core Windows Server主机捆绑包。我安装了2.1.1版。我删除了它,并安装了版本2.1.4,现在它可以工作了。
这篇关于";500-在Windows服务器上调用ASP.NET Core 2.1 Web API时出现内部服务器错误";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!