session保存到远程服务器


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

上ngix做负载均衡,ngix可以据IP固定一台服务器访问,这样可解决session共享问题,不过,还是单独一台服务器存session好一些,可以放到缓存或者服务中。

1,在web.config中配置:

<sessionState mode="StateServer" stateNetworkTimeout="10" timeout="120" stateConnectionString="tcpip=172.16.88.88:42424" >
</sessionState>

2,在指定服务器172.16.88.88中开启远程访问

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters:
AllowRemoteConnection=1