操作超时 windows 形式

The operation has timed out in windows forms

我在 windows 服务和 windows 应用程序中使用了此代码,并且我强制执行 'the operation has timed out',但是当我在网站中使用此代码时,我从不执行异常,有什么问题? !

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("<a href="https://api.telegram.org/bot99452812:AAE2MntQnStPr_J2KmrOsp_gvGZLZNsy3mE/sendMessage?chat_id=" rel="nofollow">https://api.telegram.org/bot99452812:AAE2MntQnStPr_J2KmrOsp_gvGZLZNsy3mE/sendMessage?chat_id=</a>" + row[3] + "&text=" + row[1]); request2.Timeout = 20000; WebResponse response2 = request2.GetResponse(); response2.Close();