Unable to use session state server because this version of ASP.NET requires session state server version 2.0 or above

4.3k Views Asked by At

I am migrating 2 .NET web sites from one Windows 2003 (IIS6) server to another. One of the sites is .NET 2.0 and the other is .NET 3.5. I am using the StateServer mode of ASP.NET session state with the following settings in the global web.config file (in the C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\ directory). The session state is working fine on the old server.

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

However, after installing .NET 2.0 and the .NET 3.5 SP1 framework from here, I am getting the following error message the first time (every time) after a server restart, session timeout, or application pool refresh.

Unable to use session state server because this version of ASP.NET requires session state server version 2.0 or above.[ at 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) at System.Web.SessionState.OutOfProcSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) at System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) ]

I found 2 other posts with similar symptoms, however neither of them provided a solution that worked.

  1. Unable to use session state server....requires session state server version 2.0 or above.
  2. Unable to use Session State Server

So far, I have tried:

  1. Using aspnet_regiis -ua followed by aspnet_regiis -i -enable
  2. Uninstalling and reinstalling .NET 3.5 SP1 and .NET 2.0
  3. Explicitly setting the httpRuntime enableVersionHeader attribute to true

Note I have also set up the MachineKey attribute in each application's web.config file as outlined in this MSDN article. This is something I had working on the old server that was copied over exactly the same as it was previously.

I noticed that when I had only .NET 2.0 installed the problem went away completely. It only appeared after I installed .NET 3.5 SP1. Unfortunately, one of the applications depends on .NET 3.5 for some of its functionality so leaving it uninstalled is not an option.

Any ideas how I can diagnose and fix this issue?

1

There are 1 best solutions below

0
On BEST ANSWER

Well, I burned up one of our support incidents contacting Microsoft about this issue. After about 12 hours of troubleshooting, the issue still went unresolved.

As I began to wonder if this was even a problem with Windows at all, I discovered another post with someone with exactly the same problem:

Problems with ASP.NET State Service version; state service is 1.1, website is 3.5

So, this looks like it is probably a bug with the latest version of Virtuozzo.

I ended up creating a windows service that runs the following 3 commands during startup of the server. Although I tried using .bat files and using the Windows scheduled tasks to fire the commands, I couldn't seem to get it working. It took about 5 hours to create and debug this simple Windows service, which was probably less time than it would have taken to figure out and assign the correct Windows permissions to get it running under scheduled tasks.

C:\Windows\System32\SC.EXE CONFIG aspnet_state binPath= "C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_state.exe"

C:\Windows\System32\NET.EXE stop aspnet_state

C:\Windows\System32\NET.EXE start aspnet_state

Note that I probably could have made aspnet_state depend on my Windows service so I wouldn't have to restart aspnet_state, but I wasn't sure if the dependency settings would also get trashed on reboot and making it this way meant I only had to install the service and do no other manual configuration.

Note that I also tried RunAsService so I wouldn't have to build anything myself. However, the author of that service failed to realize that a Windows service is by definition multi-threaded. I rebooted the server and it caused Windows not to start because the service didn't have enough permission to run the configured commands. Fortunately, I had a backup to go to or I would have had to rebuild my VPS from scratch. RunAsService also will not respond to a stop command because it tries to do all of its work on the main thread.