Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ZZʹÓÃSQL Server´æ´¢ASP.NET Session±äÁ¿

´´½¨ºÍÅäÖÃASP.NET Session״̬Êý¾Ý¿â
ÔÚ»ùÓÚNLB£¨ÍøÂ縺ÔØƽºâ£©»·¾³ÏµÄASP.NET WebÓ¦ÓóÌÐò¿ª·¢£¬ÎÒÃÇÐèÒª½«Session´æ´¢ÔÚÊý¾Ý¿âÖ驶à¸öWebÓ¦ÓóÌÐòµ÷Óã¬ÒÔÏÂΪÅäÖ÷½·¨¼°×¢ÒâÊÂÏî¡£
1.´´½¨ÓÃÓÚ´æ´¢ASP.NET SessionµÄÊý¾Ý¿â£¨Ô¶³Ì¡¢±¾µØ½Ô¿É£¬Ê¹ÓÃÊý¾Ý¿âÓû§Éí·ÝÈÏÖ¤£©
ÔÚWindows\Microsoft.NET\Framework/V2.0.50727Ŀ¼ÏÂʹÓÃÈçÏÂÃüÁ
aspnet_regsql.exe -S <SQL Server IP> -U <User Name> -P <Password> -E -ssadd -sstype c -d <Database Name>
ÃüÁîÖ´Ðкó¾Í»á³É¹¦½¨Á¢ÆðÓÃÓÚ´æ´¢ASP.NET Session±äÁ¿µÄÊý¾Ý¿âÁË¡£
2.Web.ConfigÎļþÅäÖÃÏî
ÎÒÃÇÐèÒªÔÚASP.NET WebÓ¦ÓóÌÐòÖеÄWeb.ConfigÎļþÐÞ¸ÄsessionStateÅäÖÃÏîÒÔʹSession״̬Êý¾Ý¿âÉúЧ¡£
ÅäÖýڵãÈçÏ£º
<sessionState mode="SQLServer"
            sqlConnectionString="server=<Server IP>;database=<Database Name>;uid=<User Name>;pwd=<Password>;"
 allowCustomSqlDatabase="True"
            cookieless="false"
            timeout="20" />
3.×¢ÒâÔÚ½øÐÐϵͳ²âÊÔ£¨Ö÷ÒªÊǸºÔزâÊÔ£©µÄʱºò£¬ÒòΪÊý¾Ý¿â·ÃÎʸºÔصÄÔö¼Ó£¬ÐèÒªµ÷ÕûSQL ServerÏàÓ¦³¬Ê±µÄÅäÖÃÏîÒÔÊÊÓ¦¸ºÔØ¡££¨Ä¬ÈÏֵΪ10£¬ÇëÊʶȽøÐе÷Õû¡££©
ASP.NET Session״̬Êý¾Ý¿âÊý¾ÝÄ£ÐÍ
1.ASPStateTempSessions±í¶¨Òå
ÁÐÃûÀàÐÍÃèÊö
SessionId
nvarchar(88)
Session ID + application ID
Created
datetime
Date and time session was created (UTC)
Expires
datetime
Date and time session expires (UTC)
LockDate
datetime
UTC date and time session was locked
LockDateLocal
datetime
Local date and time session was locked
LockCookie
int
Lock ID
Timeout
int
Session timeout in minutes
Locked
bit
1=Session locked, 0=Session not locked
SessionItemShort
varbinary(7000)
Serialized session state (if <= 7,000 bytes)
SessionItemLong
image
Serialized session state (if > 7,000 bytes)
Flags
int
Session state flags (1=Uninitialized session)
2.ASPStateTempApplications±í¶¨Òå
ÁÐÃûÀàÐ


Ïà¹ØÎĵµ£º

SQL server2000 Ôõô¸Ä±äÕʺŵÄĬÈÏÊý¾Ý¿â

´ò¿ª²éѯ·ÖÎöÆ÷£¬ÔÚ²éѯ·ÖÎöÆ÷ÏÂÖ´ÐУº
exec sp_defaultdb Õ˺ÅÃû , ĬÈÏÊý¾Ý¿â
¾ÙÀý£ºÎÒµÄĬÈÏÕ˺ÅÊÇsa£¬´ò¿ª²éѯ·ÖÎöÆ÷£¬Ä¬ÈÏÊý¾Ý¿âÊÇmaster£»ÏÖÔÚÎÒн¨ÁËÒ»¸öÊý¾Ý¿âmyData,Ï뽫ĬÈÏÊý¾Ý¿â¸ÄΪmyData£¬Ö»ÐèÖ´ÐУº         exec sp_defaultdb sa , myData  ¼´ ......

SQLÓï¾ä´óÈ«

Ò»¡¢»ù´¡
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
3¡¢ËµÃ÷£º±¸·Ýsql server
--- ´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
--- ¿ªÊ¼ ±¸·Ý
BACKUP DATABASE pubs TO testBack
4¡¢Ëµ ......

SQL Server 2005/2008¹ÜÀí£¨´ýÐø£©

-- ²é¿´µ±Ç°dbµÄµÇ½
select * from sys.sql_logins
-- ²é¿´ÐÔÄܼÇÊýÆ÷
SELECT * from sys.dm_os_performance_counters
-- Ö´ÐйýµÄÏß³ÌËùÓöµ½µÄËùÓеȴý(²»Êǵ±Ç°ÕýÔÚÔËÐеÄÏß³Ì, Ϊ×ÔÉÏ´ÎÖØÖÃͳ¼ÆÐÅÏ¢»òÆô¶¯·þÎñÆ÷ÒÔÀ´ÀÛ»ýµÄÊý¾Ý),¿É·ÖÎö¿¿Ç°µÄ¼¸¸öµÈ´ý½Ï¸ßµÄʼþ¡£
select * from sys.dm_os_wait_stats order by wa ......

asp.netʱ¼ä¸ñʽ´óÈ«

DateTime dt = DateTime.Now;
// Label1.Text = dt.ToString();//2005-11-5 13:21:25
// Label2.Text = dt.ToFileTime().ToString();//127756416859912816
// Label3.Text = dt.ToFileTimeUtc().ToString();//127756704859912816
// Label4.Text = dt.ToLocalTime().ToString();//2005-11-5 21:21:25
// Label5.Text = ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ