close

http://blog.xuite.net/pmpmppm/net/4920743

Session And Application

Server-Side
Client-Side
Application Cookies
Session ViewState
DataBase Query strings
Catch  

1.Application

 

2.Session:

1).存放於ASP.NET主機上

缺點:佔用Server端資源

開啟web.config.找到
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" (若Client不支援Cookie,可設成true,Session會儲存於Query string中)
timeout="20" (Session逾時設定)
/>

 

2).存放於SQL上

用法:把Session的資料儲存在SQL資料庫中
a)cd c:windowsMicrosoft.NETFrameworkv1.1.4322 (到Framework版本目錄下)
b)Dir *.sql (檢查一下sql程式碼)
c)osgl -E -i Installsqlstate.sql (-E:Windows整合驗證 / -i :把後面那段SQL碼import)

完成後,會在資料庫內建立一個ASPState的資料庫,內建一些預存程序,但是資料是存在tmp的資料庫中

開啟web.config.找到
<sessionState
mode="SQLServer"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>

3).存放於State Service

用法:WEB Server 、 SQL Server、 State Server分開,分散流量

開啟web.config.找到
<sessionState
mode="StateServer"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes
"

cookieless="false"
timeout="20"
/>

到服務裡啟動State Service,預設的port是42424若要改port,   HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesaspnet_stateParameters

arrow
arrow
    全站熱搜

    meltdown 發表在 痞客邦 留言(0) 人氣()