session保存在专门的StateServer中,这种方式,性能比sql略好,怎样使用StateServer 服务器呢
1、初始化StateServer服务器
启动ASP.NET 状态服务【aspnet_state】,该服务默认是手动启动的,可以通过修改注册表,设置为自动启动并允许远程连接。修改方法如下:
修改注册表: [HKEY_LOCAL_MACHINE/SYSTEM/ControlSet001/Services/aspnet_state/Parameters]设置 AllowRemoteConnection = 1 , 设置 Port = 42424 (十进制,默认即为42424) AllowRemoteConnection ,0仅能本机使用,1可以供其他机器使用.Port是服务的端口号
2、修改webconfig配置文件
<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" cookieless="false" timeout="60"/>