【问题标题】:“500 - Internal server error” when calling ASP .Net Core 2.1.7 micro-service on Windows Server在 Windows Server 上调用 ASP .Net Core 2.1.7 微服务时出现“500 - 内部服务器错误”
【发布时间】:2019-10-24 05:07:47
【问题描述】:

我有基于 ASP.Net Core 的微服务,它部署在运行 Windows 10 企业版的 IIS10 上。

当我尝试在 UAT 中对其进行测试时,该应用程序在所有较低的环境(Dev、QA)中运行良好,它开始抛出

我验证了日志,它只显示 500。在 IIS 日志中,它只显示 500 0 0。

我尝试启用详细日志,尝试在开发模式下运行,如下所示仍然没有打印详细信息:(我什至尝试从命令提示符运行相同的有限错误 500。

应用程序在内部调用另一个也在同一台机器上运行的服务,当我点击那个正在工作的独立设备时。 这是完全相同的代码和配置,在 QA 中运行良好。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <system.webServer>
   <handlers>
     <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
   </handlers>
   <aspNetCore processPath="dotnet" arguments=".\Communications.Api.dll" forwardWindowsAuthToken="false" stdoutLogEnabled="true" startupTimeLimit="3600" requestTimeout="23:00:00" stdoutLogFile=".\logs\stdout">
     <environmentVariables>
           <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
     </environmentVariables>
    <handlerSettings>
        <handlerSetting name="debugLevel" value="file" />
        <handlerSetting name="debugFile" value="D:\Communications\logs\ancm.log" />
 </handlerSettings>
   </aspNetCore>
   <security>
     <requestFiltering>
       <requestLimits maxAllowedContentLength="700000000" />
     </requestFiltering>
   </security>
    <httpErrors errorMode="Detailed" />
 </system.webServer>
     <system.web>
       <customErrors mode="Off" />
       <compilation debug="true" />
   </system.web>
</configuration>

如何获取细节以了解真正的问题:(请指导。

【问题讨论】:

  • 停止分享屏幕截图。为什么不能在此处剪切和粘贴实际文本? .\logs\stdout 文件中还写了什么?
  • 如果这里的文字对您有帮助,那就是:info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] 请求在 42622.185ms 500 application/json 中完成
  • 错误最有可能出现在 stdoutLogFile=".\logs\stdout"
  • 这样做后我得到了一个提示,我从 Localhost 运行了这些调用,看起来机器本身无法访问 LB Url,因此它超时了。因为主要服务正在使用不在同一台机器上工作的 LoadBalancer URL 调用其他服务。

标签: asp.net-core .net-core asp.net-core-2.0 iis-10


【解决方案1】:

这里是这个问题的解决方案。

QA 和 UAT 之间存在一些配置差异。

当我将 URL 更改为 localhost 时,它就开始工作了。

【讨论】:

    猜你喜欢
    • 2019-02-15
    • 1970-01-01
    • 2015-07-05
    • 1970-01-01
    • 1970-01-01
    • 2021-03-02
    • 1970-01-01
    • 2016-03-26
    • 2020-02-06
    相关资源
    最近更新 更多