Discord.net在Linux上不起作用 [英] Discord.net not working on linux

查看:97
本文介绍了Discord.net在Linux上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Linux VPS上的discord.net中编码一个discord机器人,我正在通过mono运行,但我一直收到此错误

I'm trying to get a discord bot coded in discord.net running on a linux VPS, I'm running via mono but I keep getting this error

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

我已经安装了mono和.net内核,并且正在通过mono运行它.

I have mono and .net core installed and I'm running it through mono.

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

Any suggestions? (I'd like to stick with discord.net if possible)

推荐答案

如文档中所示(

As shown in the docs (https://docs.stillu.cc/guides/getting_started/installing.html), it's not possible to run Discord.Net with Mono.

我建议您切换到 .NET Core .现在,当您编译代码时,它将输出一个.dll文件(如果是3.1+,则输出常规.exe文件)

I suggest you to switch to .NET Core. When you'll now compile the code, it will output a .dll file (and regular .exe if 3.1+)

在您的发行版上下载.NET Core运行时: https://docs.microsoft.com/zh-CN/dotnet/core/install/linux

Download .NET Core runtime on your distribution: https://docs.microsoft.com/en-us/dotnet/core/install/linux

安装完成后,您应该可以在终端中使用以下命令运行.dll文件: dotnet <path_to_dll>

Once it's installed you should be able to run the .dll file with the following command in the terminal: dotnet <path_to_dll>

这篇关于Discord.net在Linux上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆