[英]Getting error “Request timed out” using telegram bot with c#?
我要使用 c# 在电报机器人上发送 10 张带有标题的图像。但是只要去那里 2 或 3 张图像并从 api“ SendPhotoAsync ”得到这样的错误“请求超时”。我不知道错误在哪里。 我在我的本地电脑上运行这个。 并且我的电脑完全在网络中,所以为什么我会收到此错误,任何人都知道请告诉我。
这是我的代码=>
public async Task SendCasesOnTelegramBot()
{
DataSet ds = DataAccess.ExecuteDataset(Setting.ConnectionString(), "GetPostForTelegramBot");
if (ds != null && ds.Tables.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
var imageData = webClient.DownloadData(MediaPath + ds.Tables[0].Rows[i]["Url"].ToString());
ms = new MemoryStream(imageData);
var sb = new StringBuilder();
sb.Append(ds.Tables[0].Rows[i]["Description"].ToString());
await Bot.SendPhotoAsync("@abcgrop", new FileToSend(ds.Tables[0].Rows[i]["Url"].ToString(), ms), sb.ToString()); // here i am getting error
}
}
}
这是我的代码,我收到错误。
嗨,将 API超时属性设置为更高的值,例如 5 分钟。 你可能有一些网络问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.