首页 > 解决方案 > 在 Windows Server 上调用 ASP .Net Core 2.1.7 微服务时出现“500 - 内部服务器错误”

问题描述

我有基于 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>

如何获取详细信息以了解实际问题:(请指导。

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

解决方案


这是此问题的解决方案。

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

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


推荐阅读