Joh*_*ith 5 c# linux .net-core
我有一个简单的控制台应用程序:有一个循环来处理来自外部源的数据。当我使用命令dotnet MyApp.dll在bash中运行它时,但是在启动超级用户时,在日志中出现错误:
Unhandled Exception: System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.
at System.ConsolePal.ReadKey(Boolean intercept)
at Crawler.Test.Program.Main(String[] args)
Run Code Online (Sandbox Code Playgroud)
但是在主方法中,我没有调用“ Console.ReadKey”之类的东西。
我正在尝试执行类似守护程序的操作。
我的主管会议
[program:dotnetapp]
directory = /var/app/MyApp
command = /bin/bash -c "dotnet /var/app/MyApp/MyApp.dll"
numprocs = 1
autostart = true
autorestart = true
user=www-data
Run Code Online (Sandbox Code Playgroud)
主要
using (MyDisposableClass myClass = new MyDisposableClass())
{
myClass.Start();
Console.WriteLine("App started...");
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
801 次 |
| 最近记录: |