Sunday, 5 January 2014

Problem with Session StateServer mode - ASP.NET

Leave a Comment
StateServer mode stores session state in a process, referred to as the ASP.NET state service, that is separate from the ASP.NET worker process or IIS application pool. Using this mode ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.

But new user are facing problem with this Session state mode.

First ensure to use StateServer mode, you must first be sure the ASP.NET state service is running on the server used for the session store. The ASP.NET state service is installed as a service when ASP.NET and the .NET Framework are installed.

The ASP.Net state service is installed at the following location:

systemroot\Microsoft.NET\Framework\versionNumber\aspnet_state.exe

To configure an ASP.NET application to use StateServer mode, in the application's Web.config file do the following:

  1. Set the mode attribute of the sessionState element to StateServer.
  2. Set the stateConnectionString attribute to tcpip=serverName:42424.

Example:

<configuration>
  <system.web>
    <sessionState mode="StateServer"
    stateConnectionString="tcpip=SampleStateServer:42424"
    cookieless="false"
    timeout="20"/>
  </system.web>
</configuration>


Problem:

Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same.

If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection. If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.

Solution:


Main solution is allow remote connection from registry.

To allow remote connection:
  1. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection set value to 1
  2. Restart ASP.NetStateService from systemroot\Microsoft.NET\Framework\versionNumber\aspnet_state.exe.
For more information visit: http://msdn.microsoft.com/en-us/library/ms178586.aspx

By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

0 comments:

Post a Comment

Subscribe to our newsletter to get the latest updates to your inbox.

Your email address is safe with us!




Founder of developersnote.com, love programming and help others people. Work as Software Developer. Graduated from UiTM and continue study in Software Engineering at UTMSpace. Follow him on Twitter , or Facebook or .



Powered by Blogger.