发布到 IIS 的 ASP.NET Core 应用程序不返回错误 500 描述

问题描述 投票:0回答:0

所以我将这个 ASP.NET Core 应用程序部署到 IIS。发生异常时,我收到“500 Internal server error”。而且我知道实际的错误描述保存在服务器的某个地方。但是,我希望应用程序返回错误描述,就像我使用 IISExpress 从 Visual Studio 调试时一样。

即使我在本地(从服务器)尝试该应用程序,它也只会返回“500 内部服务器错误”而没有任何描述。

这就是我试过的所有内容:

  • 在调试模式下部署应用程序。
  • <httpErrors existingResponse="PassThrough"/>
    添加到
    system.webServer
    中的
    web.config
  • 部分
  • <httpErrors errorMode="Detailed"/>
    添加到
    system.webServer
    中的
    web.config
  • 部分
  • <customErrors mode="Off />
    添加到
    system.web
    中的
    web.config
    部分。
  • 从 IIS 错误页面设置:将错误响应设置为 Detailed 错误。
  • 从 IIS 网络错误页面设置:将模式设置为Off.

不知道还能做什么。我已经用头撞键盘好几个小时了。

谢谢!

c# asp.net-core iis iis-8 http-status-code-500
© www.soinside.com 2019 - 2024. All rights reserved.