2017-12-18 14 views
0

我不知道我能do.My什麼telegrambot項目突然停止後約1 day.with這樣的錯誤工作。如果可能,請幫助我。TelegramBot申請停止與此錯誤(SocketException,請IOException異常,引發WebException,HttpRequestException)工作

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() 
+0

只是''try' catch',而忽略錯誤,它的事業由長輪詢失敗 – Sean

+0

您reply.I @Sean由於改變了我的代碼,這是現在的工作,沒有錯誤。 – mona

回答

1

它的因爲你的池方式。可能你的應用程序內存或網絡連接不足。你可以簡單地忽略這個異常,你的操作系統會處理它,但是如果你打算把它用作你的長時間輪詢方法,你應該在每次請求後仔細處理這些對象。 我強烈建議使用webhook而不是更新方法。它非常快速和高效。

+0

感謝@David爲您的答覆。我的機器人項目是一個.net控制檯應用程序。我可以在其中實現webhook嗎? – mona

+0

不幸的是你不能。你應該創建web api應用程序。 – David

+0

非常感謝,我會試試。 – mona