Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Discord.net在linux上不工作_C#_Linux_Bots_Discord_Discord.net - Fatal编程技术网

C# Discord.net在linux上不工作

C# Discord.net在linux上不工作,c#,linux,bots,discord,discord.net,C#,Linux,Bots,Discord,Discord.net,我试图在linux VPS上运行discord.net中编码的discord bot,我通过mono运行,但我一直遇到这个错误 Unhandled Exception: System.Exception: Connection lost at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0

我试图在linux VPS上运行discord.net中编码的discord bot,我通过mono运行,但我一直遇到这个错误

Unhandled Exception:
System.Exception: Connection lost
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
  at Discord.TaskManager.ThrowException () <0x419160b0 + 0x00065> in <filename unknown>:0
  at Discord.Net.WebSockets.WebSocket.WaitForConnection (CancellationToken cancelToken) <0x4192a2a0 + 0x000af> in <filename unknown>:0
  at Discord.Net.WebSockets.GatewaySocket.WaitForConnection (CancellationToken cancelToken) <0x4192a1b0 + 0x000c3> in <filename unknown>:0
  at Discord.DiscordClient+<BeginConnect>d__78.MoveNext () <0x41836df0 + 0x01406> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
  at Discord.DiscordClient+<BeginConnect>d__78.MoveNext () <0x41836df0 + 0x01abe> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f0ad7fff6b0 + 0x000a7> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f0ad7fff630 + 0x0006b> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f0ad7fff5e0 + 0x0003a> in <filename unknown>:0
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () <0x7f0ad7fffb10 + 0x00012> in <filename unknown>:0
  at Discord.DiscordClient+<Connect>d__77.MoveNext () <0x41836560 + 0x002b1> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f0ad7fff6b0 + 0x000a7> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f0ad7fff630 + 0x0006b> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f0ad7fff5e0 + 0x0003a> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x7f0ad7fff5c0 + 0x00012> in <filename unknown>:0
  at MiXBot.Program+<>c+<<Main>b__1_3>d.MoveNext () <0x41835e40 + 0x001bd> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f0ad7fff6b0 + 0x000a7> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f0ad7fff630 + 0x0006b> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f0ad7fff5e0 + 0x0003a> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x7f0ad7fff5c0 + 0x00012> in <filename unknown>:0
  at Discord.DiscordClient.ExecuteAndWait (System.Func`1 asyncAction) <0x41835b00 + 0x00086> in <filename unknown>:0
  at MiXBot.Program.Main (System.String[] args) <0x417fbf60 + 0x002a3> in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.Exception: Connection lost
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
  at Discord.TaskManager.ThrowException () <0x419160b0 + 0x00065> in <filename unknown>:0
  at Discord.Net.WebSockets.WebSocket.WaitForConnection (CancellationToken cancelToken) <0x4192a2a0 + 0x000af> in <filename unknown>:0
  at Discord.Net.WebSockets.GatewaySocket.WaitForConnection (CancellationToken cancelToken) <0x4192a1b0 + 0x000c3> in <filename unknown>:0
  at Discord.DiscordClient+<BeginConnect>d__78.MoveNext () <0x41836df0 + 0x01406> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
  at Discord.DiscordClient+<BeginConnect>d__78.MoveNext () <0x41836df0 + 0x01abe> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f0ad7fff6b0 + 0x000a7> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f0ad7fff630 + 0x0006b> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f0ad7fff5e0 + 0x0003a> in <filename unknown>:0
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () <0x7f0ad7fffb10 + 0x00012> in <filename unknown>:0
  at Discord.DiscordClient+<Connect>d__77.MoveNext () <0x41836560 + 0x002b1> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f0ad7fff6b0 + 0x000a7> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f0ad7fff630 + 0x0006b> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f0ad7fff5e0 + 0x0003a> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x7f0ad7fff5c0 + 0x00012> in <filename unknown>:0
  at MiXBot.Program+<>c+<<Main>b__1_3>d.MoveNext () <0x41835e40 + 0x001bd> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f0ad7fff6b0 + 0x000a7> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f0ad7fff630 + 0x0006b> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f0ad7fff5e0 + 0x0003a> in <filename unknown>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x7f0ad7fff5c0 + 0x00012> in <filename unknown>:0
  at Discord.DiscordClient.ExecuteAndWait (System.Func`1 asyncAction) <0x41835b00 + 0x00086> in <filename unknown>:0
  at MiXBot.Program.Main (System.String[] args) <0x417fbf60 + 0x002a3> in <filename unknown>:0
未处理的异常:
系统异常:连接丢失
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中:0
位于:0中的Discord.TaskManager.ThrowException()处
位于0中的Discord.Net.WebSockets.WebSocket.WaitForConnection(CancellationToken cancelToken)处
位于0中的Discord.Net.WebSockets.GatewaySocket.WaitForConnection(CancellationToken cancelToken)处
位于Discord.DiscordClient+d_u78.MoveNext()中:0
---来自引发异常的上一个位置的堆栈结束跟踪---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中:0
位于Discord.DiscordClient+d_u78.MoveNext()中:0
---来自引发异常的上一个位置的堆栈结束跟踪---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中:0
0中的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)处
位于以下位置的System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务):0
0中的System.Runtime.CompilerServices.TaskWaiter.ValidateEnd(System.Threading.Tasks.Task任务)处
0中的System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult()处
位于Discord.DiscordClient+d_u77.MoveNext()中:0
---来自引发异常的上一个位置的堆栈结束跟踪---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中:0
0中的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)处
位于以下位置的System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务):0
0中的System.Runtime.CompilerServices.TaskWaiter.ValidateEnd(System.Threading.Tasks.Task任务)处
在0中的System.Runtime.CompilerServices.TaskAwaiter.GetResult()处
在:0中的MiXBot.Program+c+d.MoveNext()处
---来自引发异常的上一个位置的堆栈结束跟踪---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中:0
0中的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)处
位于以下位置的System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务):0
0中的System.Runtime.CompilerServices.TaskWaiter.ValidateEnd(System.Threading.Tasks.Task任务)处
在0中的System.Runtime.CompilerServices.TaskAwaiter.GetResult()处
在0中的Discord.DiscordClient.ExecuteAndWait(System.Func`1 asyncAction)处
在0中的MiXBot.Program.Main(System.String[]args)处
[错误]致命的未处理异常:系统。异常:连接丢失
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中:0
位于:0中的Discord.TaskManager.ThrowException()处
位于0中的Discord.Net.WebSockets.WebSocket.WaitForConnection(CancellationToken cancelToken)处
位于0中的Discord.Net.WebSockets.GatewaySocket.WaitForConnection(CancellationToken cancelToken)处
位于Discord.DiscordClient+d_u78.MoveNext()中:0
---来自引发异常的上一个位置的堆栈结束跟踪---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中:0
位于Discord.DiscordClient+d_u78.MoveNext()中:0
---来自引发异常的上一个位置的堆栈结束跟踪---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中:0
0中的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)处
位于以下位置的System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务):0
0中的System.Runtime.CompilerServices.TaskWaiter.ValidateEnd(System.Threading.Tasks.Task任务)处
0中的System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult()处
位于Discord.DiscordClient+d_u77.MoveNext()中:0
---来自引发异常的上一个位置的堆栈结束跟踪---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中:0
0中的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)处
位于以下位置的System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务):0
0中的System.Runtime.CompilerServices.TaskWaiter.ValidateEnd(System.Threading.Tasks.Task任务)处
在0中的System.Runtime.CompilerServices.TaskAwaiter.GetResult()处
在:0中的MiXBot.Program+c+d.MoveNext()处
---来自引发异常的上一个位置的堆栈结束跟踪---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中:0
0中的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)处
位于以下位置的System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务):0
0中的System.Runtime.CompilerServices.TaskWaiter.ValidateEnd(System.Threading.Tasks.Task任务)处
在0中的System.Runtime.CompilerServices.TaskAwaiter.GetResult()处
在0中的Discord.DiscordClient.ExecuteAndWait(System.Func`1 asyncAction)处
在0中的MiXBot.Program.Main(System.String[]args)处
我已经安装了mono和.NETCore,我正在通过mono运行它


有什么建议吗?(如果可能的话,我想继续使用discord.net)

我只是想尝试一下解决方案,因为我没有看到您提到您在linux上安装了dotnet core。下面是一个指南,其中有一个清单,可以按照您的步骤来确保它正常工作。Discord.net似乎位于.net核心中

如果之后仍然失败,请尝试在linux服务器上运行其他.net核心应用程序,看看这些应用程序是否有效。我希望这有帮助


由于缺乏上下文,我将假设您构建了