Telegram Bot C#: Выдаёт ошибку при попытке запроса botClient.GetMeAsync().Result
Вот код Main:
static void Main(string[] args)
{
//Console Settings:
Console.Title = $"Telegram bot logger 2.0. Console Started at: {DateTime.Now}.";
Console.ForegroundColor = ConsoleColor.Cyan;
//Bot Main Code
Console.WriteLine("Starting Telegram Bot. Please Wait... (Timeout = 21.5 Seconds)");
botClient = new TelegramBotClient(TOKEN, PROXY) { Timeout = TimeSpan.FromSeconds(21) };
Console.WriteLine("Bot Succsessfuly started! And working ONLINE");
var me = botClient.GetMeAsync().Result;
Console.WriteLine($"Collected bot info : bot id: {me.Id}. Bot Name: {me.FirstName}. Bot Username: {me.Username}.");
Console.WriteLine($"Started new logging from {DateTime.Now}. To stop bot and simple logger type 'stop' or 'exit'.");
Console.WriteLine("Now you can type commands.");
botClient.OnMessage += Bot_OnMessage;
botClient.StartReceiving();
while (isStopping != true)
{
string line = Console.ReadLine().ToLower();
if (line == "exit" || line == "stop")
{
Console.WriteLine("Stopping Bot...");
isStopping = true;
Console.WriteLine("Goodbye!");
}
else if (line == "help")
{
Console.WriteLine(helpDoc);
}
else
{
Console.WriteLine($"Recived unkown command: '{line}'. Type 'help' if you don't understand what do!");
}
}
}
Проблема заключается в том что при попытке запроса
var me = botClient.GetMeAsync().Result;
System.AggregateException: "127.0.0.1:54297g:4432.0. Cons"
Внутреннее исключение:
HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error).
Подробности:
System.AggregateException
HResult=0x80131500
Сообщение = One or more errors occurred. (Response status code does not indicate success: 500 (Internal Server Error).)
Источник = System.Private.CoreLib
Трассировка стека:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task1.get_Result()
at TelegramBot.ConsoleBot.Main(String[] args)
Изначально это исключение было создано в этом стеке вызовов: System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
Внутреннее исключение 1: HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error).
Ответы (1 шт):
500 (Internal Server Error, Внутренняя ошибка сервера) — код статуса в протоколе HTTP, сообщающий, что серверная программа запущена, но работает с серьёзными внутренними ошибками, препятствующими нормальной обработке запроса клиента. Ошибка должна быть исправлена на стороне сервера
System.AggregateException: "127.0.0.1:54297g:4432.0.
Явная ошибка при подключении к Proxy, некорректный порт

