Asp.net windows窗体中的操作已超时
我在windows服务和windows应用程序中使用了此代码,我强制执行“操作已超时”,但当我在网站中使用此代码时,我从未强制执行异常,有什么问题Asp.net windows窗体中的操作已超时,asp.net,service,ado.net,httprequest,telegram-bot,Asp.net,Service,Ado.net,Httprequest,Telegram Bot,我在windows服务和windows应用程序中使用了此代码,我强制执行“操作已超时”,但当我在网站中使用此代码时,我从未强制执行异常,有什么问题 string con = System.Configuration.ConfigurationManager.ConnectionStrings["TelegramServiceConnectionString"].ConnectionString; SqlConnection cn = new SqlConnection(con);
string con = System.Configuration.ConfigurationManager.ConnectionStrings["TelegramServiceConnectionString"].ConnectionString;
SqlConnection cn = new SqlConnection(con);
SqlDataAdapter da = new SqlDataAdapter("SELECT SH_Message_Sent.phone, SH_Message_Sent.text, SH_Message_Sent.update_id, FaranegarApiUsers.chat_id, FaranegarApiUsers.phone AS Expr1 FROM SH_Message_Sent INNER JOIN FaranegarApiUsers ON SH_Message_Sent.phone = FaranegarApiUsers.phone where SH_Message_Sent.phone='09127218155' order by update_id asc ", cn);
DataSet ds = new DataSet();
da.FillSchema(ds, SchemaType.Source);
da.Fill(ds);
DataTable t = ds.Tables[0];
foreach (DataRow row in t.Rows)
{
WebRequest request2 = WebRequest.Create("https://api.telegram.org/bot99452812:AAE2MntQnStPr_J2KmrOsp_gvGZLZNsy3mE/sendMessage?chat_id=" + row[3] + "&text=" + row[1]);
request2.Timeout = 20000;
WebResponse response2 = request2.GetResponse();
}
我修改了我的代码并正确地工作
WebRequest request2=WebRequest.Create(“+row[3]+”&text=“+row[1]);
请求2.超时=20000;
WebResponse response2=request2.GetResponse();
response2.Close();