I recently encountered a puzzling situation where the ASP.NET State Service (aspnet_state) disappeared from Windows Services after switching an IIS application pool between .NET Framework versions (v4 to v3.5 and back). The service was completely missing from services.msc, despite all .NET Framework versions being properly installed on the Windows Server 2008 machine.
First, let's verify the service is actually missing. Run this in Command Prompt:
sc query aspnet_state
If you get "The specified service does not exist as an installed service," we've confirmed the issue.
The service can be reinstalled using the .NET Framework installation utility:
cd %windir%\Microsoft.NET\Framework\v4.0.30319 aspnet_regiis -iru
For .NET 3.5, use this path instead:
cd %windir%\Microsoft.NET\Framework\v2.0.50727 aspnet_regiis -iru
If the above doesn't work, we can manually register the service:
sc create aspnet_state binPath= "%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_state.exe" start= auto
Then start it:
net start aspnet_state
After restoring the service, verify your web.config sessionState settings:
<configuration> <system.web> <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" timeout="20" cookieless="false"/> </system.web> </configuration>
If issues persist:
- Check Windows Event Viewer for related errors
- Verify firewall rules allow port 42424
- Confirm the service account has proper permissions
- Try rebooting after service reinstallation
To avoid similar problems:
aspnet_regiis -sn IIS_WPG aspnet_regiis -ga IIS_WPG
These commands ensure proper permissions for the IIS worker process group.
Remember that the ASP.NET State Service is crucial for out-of-process session state management. While many modern applications use SQL Server or other distributed session providers, the state service remains important for legacy applications.
I recently encountered a head-scratcher while maintaining a legacy Windows Server 2008 system. After switching an IIS application pool between .NET Framework versions (4.0 to 3.5 and back), the ASP.NET State Service vanished from the Services console. This service (aspnet_state.exe) is crucial for session state management in out-of-process scenarios.
Before attempting to restore the service, verify its actual status:
sc query aspnet_state
If the service isn't found, you'll get error 1060. Also check:
dir %WINDIR%\Microsoft.NET\Framework\v4.0.30319\aspnet_state.exe
dir %WINDIR%\Microsoft.NET\Framework\v2.0.50727\aspnet_state.exe
Here's the complete restoration process:
:: For .NET 4.0
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i -enable
:: For .NET 2.0/3.5
%WINDIR%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i -enable
Check these registry keys exist and have proper values:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\aspnet_state]
"Type"=dword:00000010
"Start"=dword:00000003
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):25,00,77,00,69,00,6e,00,64,00,69,00,72,00,25,00,5c,00,4d,00,\
69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,2e,00,4e,00,45,00,54,00,5c,\
00,46,00,72,00,61,00,6d,00,65,00,77,00,6f,00,72,00,6b,00,5c,00,76,00,34,00,\
2e,00,30,00,2e,00,33,00,30,00,33,00,31,00,39,00,5c,00,61,00,73,00,70,00,6e,\
00,65,00,74,00,5f,00,73,00,74,00,61,00,74,00,65,00,2e,00,65,00,78,00,65,00,\
00,00
"DisplayName"="ASP.NET State Service"
"Description"="Provides support for out-of-process session states for ASP.NET."
If the service remains problematic, consider these session state alternatives in web.config:
<system.web>
<sessionState
mode="SQLServer"
sqlConnectionString="Data Source=myServer;Initial Catalog=aspnetstate;Integrated Security=True"
cookieless="false"
timeout="20"/>
</system.web>
Or for InProc mode (not recommended for web farms):
<sessionState mode="InProc" timeout="20" cookieless="false"/>
To avoid future issues:
- Always restart IIS after .NET Framework version changes:
iisreset
- Create a system restore point before switching framework versions
- Document all service dependencies before making changes