.net 5控制台程序无法在centos后台运行

dotnet run的情况下,程序正常运行

但是当我使用在后台运行命令时,报错Access to the path is denied.

nohup: ignoring input
6/10/2021 9:44:37 AM进入
Unhandled exception. System.UnauthorizedAccessException: Access to the path is denied.
 ---> System.IO.IOException: Bad file descriptor
   --- End of inner exception stack trace ---
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Interop.CheckIo(Int64 result, String path, Boolean isDirectory, Func`2 errorRewriter)
   at System.ConsolePal.Read(SafeFileHandle fd, Byte[] buffer, Int32 offset, Int32 count)
   at System.ConsolePal.UnixConsoleStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.StreamReader.ReadBuffer()
   at System.IO.StreamReader.ReadLine()
   at System.IO.SyncTextReader.ReadLine()
   at System.Console.ReadLine()
   at HealthCheck3.Program.Main(String[] args) in /home/HealthCheck3/HealthCheck3/Program.cs:line 14

 

看日志报错是对指定的目录没有执行权限,注意看下启动用户,有没有权限,这个应用是否需要普通用户来运行