ASP. NET stores session StateServer

Source: Internet
Author: User
As the company wants to balance the server load, the web project is deployed on each of the two front-end servers (web1 and web2. However, sessions are used in the project. After logging on to web1 at the beginning, the load may increase after web1, so it is possible to jump from web1 to web2.
I have found a lot of information from the Internet, and I 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 use stateconnectionstring = "TCPIP = 127.0.0.1: 42424". It is okay to do this on a Web server, but change stateconnectionstring to stateconnectionstring = "TCPIP = 192.168.1.82: 42424. Microsoft did not provide specific solutions, and the msdn examples all point to 127.0.0.1. Later, after research and consultation with experts, I learned that I had to modify the registry of the server that saved sessin. Here it is 192.168.1.82. The modification is as follows:
Modify the registry:

HKEY_LOCAL_MACHINE "system" CurrentControlSet "services" aspnet_state "Parameters

 

Allowremoteconnection = 1

 

Then restart 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 the test, it was OK. Hope to help others.

Another problem is still hard to understand. On the WAP page I created, there will be viewstate stored data. When the page is refreshed continuously, the data in the page will be lost, and the time is definitely not more than 20 minutes. I don't know whether it is a Microsoft bug or something. This problem won't occur on the web page. .

After a period of exploration, it is best to use less viewstate on the WAP page. If the Asp.net status service is enabled, it is best to set cookieless to true; otherwise, session loss may occur.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.