TelegramBot应用程序停止处理此错误(SocketException,IOException,WebException,HttpRequestException)

问题描述 投票:0回答:1

我不知道我该怎么办。我的telegrambot项目在大约1天后突然停止工作。这个错误。请尽可能帮助我。

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()
c# asp.net telegram-bot
1个回答
1
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.