TelegramBots / Telegram.Bot

.NET Client for Telegram Bot API
https://telegrambots.github.io/book
MIT License
3.22k stars 692 forks source link

Error while copying content to a stream. #851

Closed nachiketmore closed 4 years ago

nachiketmore commented 4 years ago

I found a bug to report

Please use the following template to ensure maintainers can reproduce the bug and solve it quickly.

Bug reports that do not follow this template will be kept closed because not-reproducible until the creator edits the post properly.

Steps to reproduce

Expected behavior

Actual behavior

Screenshots

Environment data

NuGet Package Version: 15.0.0

.NET Version: 4.5.2

IDE: VS2015

App: Desktop C# WPF screenshot1 screenshot2

using (Stream stream = new FileStream(Globals.PayslipPath, FileMode.Open)) { await bot.SendChatActionAsync(item.Message.Chat.Id, Telegram.Bot.Types.Enums.ChatAction.UploadDocument); InputOnlineFile onlineFile = new InputOnlineFile(stream, "Payslip.pdf"); await bot.SendDocumentAsync(item.Message.Chat.Id, onlineFile); //Thread.Sleep(120000); } throws exception: An error occurred while sending the request. Source: mscorlib StackTrace: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Telegram.Bot.TelegramBotClient.d541.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at PaySlip.Business.BULogic.d28.MoveNext() in C:\Users\Nachiket More\documents\visual studio 2015\Projects\PaySlip\PaySlip\Business\BULogic.cs:line 876 InnerException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. Source: System StackTrace: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Telegram.Bot.TelegramBotClient.d541.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at PaySlip.Business.BULogic.d28.MoveNext() in C:\Users\Nachiket More\documents\visual studio 2015\Projects\PaySlip\PaySlip\Business\BULogic.cs:line 876 Please help me out for these problem month ago it work fine but now at deployment it gives error.

nachiketmore commented 4 years ago

hello, any updates for my issue....?

karb0f0s commented 4 years ago

Looks like connection issue. Try run on another host or configure proxy.