C#discord机器人获胜';我不能开始。与discord的连接总是失败

C#discord机器人获胜';我不能开始。与discord的连接总是失败,c#,discord,discord.net,C#,Discord,Discord.net,我多次尝试重新生成我的令牌,但总是出现相同的错误。我正在使用Discord.net 这是我的主要功能 using System; namespace Botto_commando { class Program { static void Main(string[] args) { var bot = new botto(); bot.MainAsync().GetAwaiter().GetResu

我多次尝试重新生成我的令牌,但总是出现相同的错误。我正在使用Discord.net

这是我的主要功能

using System;

namespace Botto_commando
{
    class Program
    {
        static void Main(string[] args)
        {
            var bot = new botto();
            bot.MainAsync().GetAwaiter().GetResult();
        }
    }
}
这里是所有机器人的地方

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Discord;
using Discord.WebSocket;

namespace Botto_commando
{
    public class botto
    {
        private DiscordSocketClient _client;
        public async Task MainAsync()
        {
            _client = new DiscordSocketClient();
            _client.Log += Log;
            var token = "MY BOT TOKEN GOES HERE";

            await _client.LoginAsync(TokenType.Bot, token);
            await _client.StartAsync();

            await Task.Delay(-1);



        }
        private Task Log(LogMessage msg)
        {
            Console.WriteLine(msg.ToString());
            return Task.CompletedTask;
        }
    }
}
无论何时编译和运行,都会出现以下错误:

System.Net.Http.HttpRequestException: 'An attempt was made to access a socket in a way forbidden by its access permissions
提示:搜索实际异常以查找各种提示、原因和解决方案。有许多可能性。
[Error] Request to https://discord.com/api/v7/gateway/bot triggered an HttpException
System.Net.Http.HttpRequestException: An attempt was made to access a socket in a way forbidden by its access permissions.
 ---> System.Net.Sockets.SocketException (10013): An attempt was made to access a socket in a way forbidden by its access permissions.