2015-09-26 18 views
0

我在Windows服務和Windows應用程序中使用此代碼,並強制'操作已超時',但是當我在網站中使用此代碼時,我從不強制執行異常,有什麼問題? !該操作已超時在Windows窗體中

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(); 

     } 

回答

相關問題