protected void Application_End(object sender, EventArgs e)
{
SqlHelperSQLHIS.ExecuteNonQuery(" INSERT INTO a_test (cont) VALUES ('程序回收了') ", CommandType.Text);
//下面的代碼是關鍵,可解決IIS應用程序池自動回收的問題
Thread.Sleep(1000);
//這里設置你的web地址,可以隨便指向你的任意一個aspx頁面甚至不存在的頁面,目的是要激發Application_Start
string url = "http://m.91zn.cn:81/AmebaScore/Test01.aspx";
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
Stream receiveStream = myHttpWebResponse.GetResponseStream();//得到回寫的字節流
SqlHelperSQLHIS.ExecuteNonQuery(" INSERT INTO a_test (cont) VALUES ('程序自動重新啟動了') ", CommandType.Text);
}