Asp.net website Status Service

Source: Internet
Author: User

I encountered a technical problem when I was working in a small telecommunications company. At that time, I decided to install an asp.net application on two servers for load balancing, as A result, the project manager and mobile technical staff discussed the problems encountered during such deployment and thought about the user status. For example, when A user logs on to server, I recorded the identity creden, such as session, but may access server B when I click another page. Will the system ask the user to log on again? At that time, the project manager and Technical Director who had been working for ten years were worried, and the website was still on one machine, while the MMS and SMS applications were divided into two machines for sub-deployment. This problem was also gone.

Now, you can solve this problem through simple configuration.

For the sessionState node configuration scheme of web. config, there are four sessionState modes: off, inProc, StateServer, and SqlServer.

The StateServer session management mode is configured as follows:

Set the mode attribute to StateServer, that is, store session data to a separate memory buffer, and then run on a separate machine.

To control the buffer zone. The full name of the Status Service is "ASP. NET State Service (aspnet_state.exe). You can see this Service in the Computer Management-Service and start this Service j.

It is configured by the stateConnectionString attribute in the Web. config file. This attribute specifies the server where the service is located

Depending on the Port:
<SessionState mode = "StateServer"
StateConnectionString = "tcpip = myserver: 42424"
Cookieless = "false" timeout = "20"/>

In this example, the status service runs on port 42424 (default port) of a machine named myserver. Change on the server

You can edit the Port value in the HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ aspnet_state \ Parameters registry.

Obviously, the advantage of using status service is process isolation, which can be shared in the Web farm (website group. In this mode, session state storage will not

It depends on the failure or restart of the iis process. However, once the status service is stopped, all session data will be lost. In other words, the status service does not

Data can be stored permanently like SQL Server; it only stores data in memory.

 

The solution to the previous problem is simple.:

1. The status service can be enabled on the third sub-C, which stores user uploaded files, statuses, logs, and so on.

 

2. Modify the Registry on the C-host and set

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ aspnet_state \ Parameters

Set AllowRemoteConnection in to 1. You can also change the Port to set the value you want. The default value is 42424.

 

3. Configure the Status Configuration items in web. config of the website on Application Server A and Application Server B as follows:

<SessionState mode = "StateServer"
StateConnectionString = "tcpip = IP address of the C server: 42424"
Cookieless = "false" timeout = "20"/>

Then, add the IP ing between the website domain name and server A and server B on the TNS server.

 

For the sessionState node configuration scheme of web. config, there are four sessionState modes: off, inProc, StateServer, and SqlServer.

The StateServer session management mode is configured as follows:

Set the mode attribute to StateServer, that is, store session data to a separate memory buffer, and then run on a separate machine.

To control the buffer zone. The full name of the Status Service is "ASP. NET State Service (aspnet_state.exe). You can see this Service in the Computer Management-Service and start this Service j.

It is configured by the stateConnectionString attribute in the Web. config file. This attribute specifies the server where the service is located

Depending on the Port:
<SessionState mode = "StateServer"
StateConnectionString = "tcpip = myserver: 42424"
Cookieless = "false" timeout = "20"/>

In this example, the status service runs on port 42424 (default port) of a machine named myserver. Change on the server

You can edit the Port value in the HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ aspnet_state \ Parameters registry.

Obviously, the advantage of using status service is process isolation, which can be shared in the Web farm (website group. In this mode, session state storage will not

It depends on the failure or restart of the iis process. However, once the status service is stopped, all session data will be lost. In other words, the status service does not

Data can be stored permanently like SQL Server; it only stores data in memory.

 

The solution to the previous problem is simple.:

1. The status service can be enabled on the third sub-C, which stores user uploaded files, statuses, logs, and so on.

 

2. Modify the Registry on the C-host and set

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ aspnet_state \ Parameters

Set AllowRemoteConnection in to 1. You can also change the Port to set the value you want. The default value is 42424.

 

3. Configure the Status Configuration items in web. config of the website on Application Server A and Application Server B as follows:

<SessionState mode = "StateServer"
StateConnectionString = "tcpip = IP address of the C server: 42424"
Cookieless = "false" timeout = "20"/>

Then, add the IP ing between the website domain name and server A and server B on the TNS server.

 

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.