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.


Dear all,
Due to the known problem of session variables getting lost if using InProc-server during frequent changes in development, I had to choose between SQL and ASP.NET State server, so I opted for the second. Initially, all fine, but after using it for a few days, I started to get this error:
 Server Error in '/cv2' Application.
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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: 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.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): 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.]
   System.Web.SessionState.OutOfProcSessionStateStore.MakeRequest(StateProtocolVerb verb, String id, StateProtocolExclusive exclusiveAccess, Int32 extraFlags, Int32 timeout, Int32 lockCookie, Byte[] buf, Int32 cb, Int32 networkTimeout, SessionNDMakeRequestResults& results) +1565
   System.Web.SessionState.OutOfProcSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +192
   System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +355
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
 Meanwhile the event log on the server (W2K2003) always logged this error (rI've emoved some details from it):
 Event code: 3009
Event message: Unable to make the session state request to the session state server. Details: last phase='Reading response from the state server', error code=0x8007274C, size of outgoing data=45999
Event time: 9/29/2006 11:40:17 AM
Event time (UTC): 9/29/2006 3:40:17 AM
Event ID: 0ec55d45b61f457d95d3d3c256d7cab7
Event sequence: 4
Event occurrence: 1
Event detail code: 50016

Application information:
    Application domain: /LM/W3SVC/1/Root/cv2-4-128039748000937500
    Trust level: Full
    Application Virtual Path: **********
    Application Path: **********
    Machine name: **********

Process information:
    Process ID: 720
    Process name: w3wp.exe
    Account name: NT AUTHORITY\NETWORK SERVICE

Exception information:
    Exception type: HttpException
    Exception message: 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.

Request information:
    Request URL: **********
    Request path: **********
    User host address: 192.168.0.181
    User: **********
    Is authenticated: True
    Authentication Type: Forms

Thread information:
    Thread ID: 1
    Is impersonating: False
    Stack trace:


Custom event details:
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
"Of course" the link http://go.microsoft.com/fwlink/events.asp did not help, "we're sorry" page showed up.
I also saw a lot of abandoned posts asking about lost session state on this forum when searching. Some suggested increasing the time out, which I believe had nothing to do with the issue.
The state service configuration worked fine when running on the development machine, and I was 100% sure the asp.net state service had the correct and same port numbers.
I also tried the latest VS 2005 SP1 beta on dev. machine and server but no effect on the issue (although it solved some other bugs).
I also tried setting the ASP.NET state server registry key to accept remote connections (flag to 1 instead of 0), but no effect.
It turned out this KB solved the issue:
 Interestingly enough, I have not uninstalled the .NET 1.1 framework, and the server is a plain 32-bit platform, so the title was pretty misleading.
So I "adapted" the hotfix to:
1. change dir to: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
2. type aspnet_regiis -i -enable|
3. Machine chews command for about 1 minute or so
4. Done! When I click "log in" button on the start page with correct credentials, the session state is working fine again.
And actually, that's all!
Apparently, the ASP.NET 2.0 framework with IIS was corrupted, but I can't recall any particular action that specifically broke it, except that I did a system restart, which may have triggered some pending action initiated long ago.
Would be interesting to know if this solves the problem for others who have the same issue.
 SOLUTION:
I went into web config file and saw seesion sate mode was set to "instate" and I changed that to "InProc" and it worked
< sessionState mode="InProc" timeout="30" />

 Thanks to asp.net

No comments:

Post a Comment

Keep ur coding aside.. Relax for some time..