[英]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.