ÀûÓÃCache£¬asp.net ¼òµ¥ÊµÏÖ¶¨Ê±Ö´ÐÐÈÎÎñ
private
static
CacheItemRemovedCallback OnCacheRemove
=
null
;
protected
void
Application_Start(
object
sender, EventArgs e)
{
AddTask(
"
DoStuff
"
,
60
);
}
private
void
AddTask(
string
name,
int
seconds)
{
OnCacheRemove
=
new
CacheItemRemovedCallback(CacheItemRemoved);
HttpRuntime.Cache.Insert(name, seconds,
null
,
DateTime.Now.AddSeconds(seconds), Cache.NoSlidingExpiration,
CacheItemPriority.NotRemovable, OnCacheRemove);
}
public
void
CacheItemRemoved(
string
k,
object
v, CacheItemRemovedReason r)
{
//
do stuff here if it matches our taskname, like WebRequest
//
re-add our task so it recurs
AddTask(k, Convert.ToInt32(v));
}
Ïà¹ØÎĵµ£º
дÁËÒ»¸ö´´½¨ÐéÄâĿ¼µÄ WebService ³ÌÐò£¬ÔÚ²âÊÔÔËÐÐʱ¿ÉÒԳɹ¦´´½¨£¬µ«ÆäËü³ÌÐòµ÷ÓÃʱ£¬ÌáʾûÓÐȨÏÞ´´½¨¡£
²éÁËһЩ×ÊÁÏ£¬ÔÚweb.configÀïÃæµÄ<system.web>ºó¼ÓÉÏÅäÖãº
<identity impersonate="true" userName="²Ù×÷ϵͳÓû§Ãû" password="Óû§¶ÔÓ¦µÄÃÜÂë" />
ÎÊÌâ½â¾ö¡£Ìش˼Ǽ£¬È¨ ......
+++ ÔÚWebÓ¦ÓóÌÐò¿ª·¢ÖУ¬»º´æ¶ÔÓ¦ÓóÌÐòÐÔÄܵÄÌá¸ßÓкܴó°ïÖú¡£±ÈÈ磬ÔÚͬһ¸öÓ¦ÓÃÖУ¬¾³£·¢Éú¶ÔͬһÊý¾Ý¡¢Âß¼¹¦ÄܺÍÓû§½çÃæµÄ¶à´ÎÇëÇó¡£µ±Óû§µÄ»ùÊýºÜ´óʱ£¬Èç¹ûÿ´ÎµÄÇëÇ󶼽øÐд¦Àí£¬Ôò»áÏûºÄºÜ¶àµÄ·þÎñÆ÷×ÊÔ´¡£ÁíÍ⣬ÓÐʱ·þÎñÆ÷ÌṩµÄÊý¾Ý·þÎñ¿ÉÄÜ»áÒâÍâµØÍ£Ö¹£¬Ê¹Óûº´æ¼¼Êõ¿ÉÒÔÔÚÒ»¶¨Ê±¼äÄÚÈÔÈ»Õý³£µØÌṩ¶Ô×îÖ ......
+++ ASP.NET»º´æÖеÄÊý¾ÝÊDz»Îȶ¨µÄ£¬²»»á±»ÓÀ¾ÃµØ´æ´¢£¬¿ÉÄÜ»áÓÉÓÚÒÔÏÂÔÒòÖ®Ò»¶ø´Ó»º´æÖб»×Ô¶¯ÒƳý£º
1) »º´æÂúÁË
2) »º´æÏîÒѾ¹ýÆÚ
3) »º´æÒÀÀµµÄÏî¸Ä±äÁË
+++ ³ýÁË¿ÉÒÔ×Ô¶¯ÒƳý»º´æÏîÍ⣬Äã¿ÉÒÔÏÔʾÒƳý»º´æÏî¡£ÁíÍ⣬µ±ÄãÓÃInsert·½·¨ºÍAdd·½·¨Ïò»º´æÖÐÌí¼ÓµÄ»º´æÏîÒѾ´æÔÚʱ£¬ÄÇô£¬ÔÀ´µÄ»º´æÏ±»×Ô¶¯É¾³ý¡ ......
+++ Ò³Ãæ´úÂëÈçÏ£º
<asp:Button ID="Button1" runat="server" Text="Ìí¼Ó¿ÕÐÐ" OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="±£´æËùÓÐ" OnClick="Button2_Click" />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="403px">
......
+++ Ò³Ãæ´úÂëÈçÏ£º
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" PageSize="3"
AutoGenerateColumns="true" DataKeyNames="username" DataSourceID="SqlDataSource1"
AutoGenerateDeleteButton="True"
AutoGen ......