一、现象
将在windows开发环境下正常运行的.net core webapi程序部署到centOS下,调用部分API时出现500错误。
二、环境
- .NET Core 3.1
- CentOS 8.2
- Supervisor 4.2
三、问题解决
1.查看日志文件
因为通过Supervisor 监控,根据Supervisor 配置文件,找到日志文件。
stderr_logfile=/var/log/supervisor/Sudo.Sms.WebApi.err.log ; 错误日志文件
stdout_logfile=/var/log/supervisor/Sudo.Sms.WebApi.out.log
; 输出日志文件
发现输出日志文件中有如下问题:
Connection id “0HM4EIP97R2BN”, Request id “0HM4EIP97R2BN:00000001”: An
unhandled exception was thrown by the application.
System.IO.FileNotFoundException: Could not load file or assembly
‘System.Private.ServiceModel, Version=4.1.2.4, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a’. The system cannot find the file
specified.Fil