session共享设置

 

参考网址:
https://www.cnblogs.com/xinhaijulan/archive/2010/08/21/1805116.html
https://blog.51cto.com/kerry/2314925

 

使用StateServer:

存储Session的服务器必须开启StateServer:ASP.NET状态服务。只有机器重起的情况下才导致Session丢失。

<sessionState cookieless="false" timeout="50" mode="StateServer" stateConnectionString="tcpip=IpAddress:42424"/>

若StateServer在本机存储,则IpAddress为:127.0.0.1;若StateServer为远程服务器,则为IpAddress为远程服务器IP地址,并且修改注册表项如下:


打开注册表:regedit.exe


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters]

"Port"=dword:0000a5b8

"AllowRemoteConnection"=dword:00000001

 


设置之后,一定要记得重启服务器

 

posted @ 2022-03-18 09:44  violety  阅读(46)  评论(0编辑  收藏  举报