title: Intermittent ASP.Net State Service Error
body: <p>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:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>I have verified that the session state service is running, and it is trying to connect to local host:</p>
  
  <pre><code>&lt;sessionState mode="StateServer" 
  stateConnectionString="tcpip=127.0.0.1:42424" timeout="100"/&gt;
  </code></pre>
  
  <p>In my research I came across the following forum post:
  <a href="http://forums.asp.net/t/1409990.aspx" rel="noreferrer">http://forums.asp.net/t/1409990.aspx</a></p>
  
  <p>But there wasn't any resolution about this issue, other than trying to run session state in SQL mode.</p>
  
  <p><strong>TL;DR:</strong> Getting Session state service errors saying the service is not responding, even though the service is running on the same machine. </p>