10
votes

I am trying to use State Server sessions.

I have changed my Session state to the following:

<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" cookieless="false" timeout="20" />

Running my website from local host and everything works fine.

But when i publish my website and try run it online i get the following error:

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.

The website is hosted on Afrihost servers, after resarching the error i found that it could be because ASP.NET State service has not been started. Is there a way i could check if the Afrihost servers are running this service or to start it remotely?

Also i know the IP address 127.0.0.1 is for local host, but because you are publishing your application on webserver it becomes local to that machine is this correct.

1
Can you make an RDP connection on the server ? If so, make sure the service is properly started (in services.msc) and if it doesn't start correctly, check the Windows event logSuperzadeh
@CharlesAD I don't think Afrihost allows RDP connections to there server, as they host most website for south africa.Pomster

1 Answers

23
votes

That error message means the ASP.NET State service is not running.

Your connection string should always be stateConnectionString="tcpip=127.0.0.1:42424" As wherever the site is hosted that will be the local machine.

After contacting Afrihost and asking them to restart the Service everything started to run fine.

enter image description here