TelegramBot 应用程序停止工作并出现此错误(SocketException、IOException、WebException、HttpRequestException)

TelegramBot application stop working with this errors (SocketException,IOException,WebException,HttpRequestException)

我不知道 do.My telegrambot 项目在大约 1 day.with 个错误后突然停止工作。 如果可能的话,请帮助我。

Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Net.Sockets.SocketException
at System.Net.Sockets.Socket.EndReceive(System.IAsyncResult)
at System.Net.Sockets.NetworkStream.EndRead(System.IAsyncResult)

Exception Info: System.IO.IOException
at System.Net.Security._SslStream.EndRead(System.IAsyncResult)
at System.Net.TlsStream.EndRead(System.IAsyncResult)
at System.Net.PooledStream.EndRead(System.IAsyncResult)
at System.Net.Connection.ReadCallback(System.IAsyncResult)

Exception Info: System.Net.WebException
at System.Net.HttpWebRequest.EndGetResponse(System.IAsyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(System.IAsyncResult)

Exception Info: System.Net.Http.HttpRequestException
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetResult() at Telegram.Bot.TelegramBotClient+<SendWebRequestAsync>d__1091[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()

Exception Info: System.AggregateException
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetResultCore(Boolean) at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].get_Result()
at Mybot.BotForm.RunBot()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()

这是因为你的汇集方式。可能您的应用程序内存或网络连接不足。你可以简单地忽略这个异常,你的操作系统会处理它,但如果你打算使用它作为你的长轮询方法,你应该在每次请求后仔细处理对象。 我强烈建议使用 webhook 而不是获取更新方法。速度更快、效率更高。