Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intermittent ASP.Net State Service Error

We are hosting an ASP.net website on a virtual machine. the ASP.net Session state service is running. However, we get the following exception every once and a while:

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.

I have verified that the session state service is running, and it is trying to connect to local host:

<sessionState mode="StateServer" 
stateConnectionString="tcpip=127.0.0.1:42424" timeout="100"/>

In my research I came across the following forum post: http://forums.asp.net/t/1409990.aspx

But there wasn't any resolution about this issue, other than trying to run session state in SQL mode.

TL;DR: Getting Session state service errors saying the service is not responding, even though the service is running on the same machine.

like image 541
Nathan Tregillus Avatar asked Nov 06 '13 16:11

Nathan Tregillus


2 Answers

After a LOT of debugging, I found that one of our developers had attempted to improve view state performance by saving it into the session for two particular pages. When the user reached around 20 different sets of view state, the session service became overloaded, and started to flake out.

I have modified the page to no longer require view state, and this exception has not occurred.

like image 54
Nathan Tregillus Avatar answered Nov 08 '22 22:11

Nathan Tregillus


Check if your session state provider executable path is set properly, try different ones (from .NET 2.0 to 4.0 or vice versa). Last week we have patched our servers with Microsoft updates and one of side effects was a silent change of executable of ASP.NET Session State service from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_state.exe to C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_state.exe and we have such errors also. You can check it in Windows Services console.

like image 37
Konrad Kokosa Avatar answered Nov 08 '22 22:11

Konrad Kokosa