Since the company needs to load balance the server, the web project deploys one on each of the two front-end servers (web1 and web2). But sessions are used in projects. When you first land on web1, it is possible to jump from web1 to web2 because the load may increase after web1. I found a lot of information from the Internet, and I also understand the configuration in web.config <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" timeout="30" cookieless="AutoDetect" /> Many examples on the Internet are stateConnectionString="tcpip=127.0.0.1:42424", which is of course fine on a web server, but when you change stateConnectionString to stateConnectionString="tcpip=192.168.1.82: 42424", there will be problems with both frontends. Microsoft did not give a specific solution, and the examples on MSDN also point to 127.0.0.1. Later, after researching and consulting experts, I realized that I had to modify the registry of the server that saves Sessin, here it is 192.168.1.82, and the modification is as follows: Modify the registry:
HKEY_LOCAL_MACHINE"SYSTEM"CurrentControlSet"Services"aspnet_state"Parameters
AllowRemoteConnection=1
Then restart the ASP.NET State Service
The connection configuration is as follows:
<sessionState mode="StateServer" stateConnectionString="tcpip=192.168.1.200:42424" cookieless="AutoDetect" timeout="60" />
After that, it was OK after testing. Hope it helps others. There is another problem that I still don't understand. The wap page I made will have the data stored in the ViewState on the page, and when the page is constantly refreshed, the data in it will be lost, and the time will never exceed 20 minutes. I don't know if it's a bug from Microsoft or what, this problem doesn't appear on web pages. Solution. After a period of exploration, it is best to use less viewstate on the WAP page, and if the asp.net state service is enabled, then it is best to set cookieless to true, otherwise the session will be lost. |