.NET状态服务器:无法向会话状态服务器发出会话状态请求

时间:2018-10-25 22:16:56

标签: c# asp.net session stateserver

我在使用现有应用程序时遇到了问题,因此我创建了一个全新的MVC应用程序,除了读取会话状态外没有其他功能,并且遇到了同样的问题。

此行位于web.config中:

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

当应用程序运行并尝试利用会话时,我得到了以下信息: “无法向会话状态服务器发出会话状态请求。”

完整的错误堆栈和版本信息:

[HttpException (0x80070057): 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.]
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) +3251784
System.Web.SessionState.OutOfProcSessionStateStore.DoGet(HttpContext context, String id, StateProtocolExclusive exclusiveAccess, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags) +169
System.Web.SessionState.OutOfProcSessionStateStore.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags) +26
System.Web.SessionState.SessionStateModule.GetSessionStateItem() +111
System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +778
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +254
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +159
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3160.0

我已验证ASP.NET状态服务正在运行,已验证注册表数据正确,已验证防火墙已完全关闭,因此不应阻止本地端口,等等。我还能做什么来验证连接性状态服务器,可能会发生什么?

我试图重新安装Framework 4.5,但是由于已经安装了它,所以它什么也没做。 (该应用使用Framework 4.5,顺便说一句)。
我尝试了使用aspnet_regiis的旧建议,但是显然在更高的Framework版本中这不是一个选择。我在这里和其他地方都几次问过这个问题,但是所有这些问题都已经通过我已经采取的步骤解决了,所以我不确定从这里去哪里。

感谢任何可以提供帮助的人!

(编辑/添加: 我还将注册表中的AllowRemoteConnection设置为1。 我验证了该服务似乎正在监听:

C:\WINDOWS\system32>netstat -aon | find /i "42424"
  TCP    0.0.0.0:42424          0.0.0.0:0              LISTENING       4256

0 个答案:

没有答案