"500-内部服务器错误";在Windows Server上调用ASP .Net Core 2.1 Web API时 [英] "500 - Internal server error" when calling ASP .Net Core 2.1 Web API on Windows Server

查看:86
本文介绍了"500-内部服务器错误";在Windows Server上调用ASP .Net Core 2.1 Web API时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP .Net Core 2.1 Web API,已将其部署到我们最近购买的新服务器(运行Windows Server 2016 Standard).该API在我的开发PC和我们的旧服务器(运行Windows Server 2012 R2)上均可完美运行.但是在这台新服务器上,我收到此错误:

I have an ASP .Net Core 2.1 Web API which I've deployed to a new server we recently purchased (running Windows Server 2016 Standard). The API works perfectly on both my development PC and our old server (running Windows Server 2012 R2). But on this new server, I get this error:

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" ,但它没有生成日志-我已经创建了 \ logs \stdout 路径,因此文件夹确实存在...

I remember a year ago also struggling a lot trying to get it to run on our old server. I did eventually get it to work, but I can't remember what I did! Is there any way to get more information on this error? I've checked the Windows Event Viewer on the new server and there is nothing there. Also, although I've got stdoutLogEnabled="true" in my web.config, it's not generating the log - and I've created the \logs\stdout path so the folders do exist...

我在 Startup.cs 中也有 app.UseDeveloperExceptionPage(); ,但是我没有得到更多有关简单的500个内部服务器错误的信息

I've also got app.UseDeveloperExceptionPage(); in my Startup.cs, but I'm not getting any more info that a simple 500 internal server error.

这是我的web.config的样子:

This is what my web.config looks like:

<?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=".\logs\stdout" />
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: cfa62a1f-c5f6-43f8-bcbe-04068e40b803-->

我还安装了 Microsoft .NET Core 2.1.1-Windows Server Hosting Microsoft .NET Core Runtime-2.1.1 (均为x86)和x64).

I've also got the Microsoft .NET Core 2.1.1 - Windows Server Hosting installed and the Microsoft .NET Core Runtime - 2.1.1 installed (both x86 and x64).

就像我说的那样,它可以在我的开发PC和旧服务器上使用,因此在新服务器上一定是配置问题.除了500 Internal Server Error之外,还有其他方法可以获取更详细的错误信息吗?谢谢...

Like I said it works on my development pc and on our old server, so it must be a configuration issue on the new server. Is there a way I can get more detailed error information other than just 500 Internal Server Error? Thanks...

推荐答案

我终于明白了!我具有.Net Core Windows Server Hosting捆绑包的过时版本.我安装了2.1.1版.我删除了它,并安装了版本2.1.4,现在可以使用了.感谢大家的时间和支持.我真的很感激!

I finally figured it out! I had an outdated version of the .Net Core Windows Server Hosting bundle. I had version 2.1.1 installed. I removed it, and installed version 2.1.4 and now it works. Thanks everyone for your time and support. I really appreciate it!

这篇关于"500-内部服务器错误";在Windows Server上调用ASP .Net Core 2.1 Web API时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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