我随机收到以下错误,有时有效,但有时会失败:
无法向会话状态服务器发出会话状态请求。请确保 ASP.NET State 服务已启动并且客户端和服务器端口相同。如果服务器在远程机器上,请通过检查 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection 的值来确保它接受远程请求。如果服务器在本地机器上,并且如果前面提到的注册表值不存在或设置为 0,则状态服务器连接字符串必须使用“localhost”或“127.0.0.1”作为服务器名称。
我在 Web.config 中的 sessionState 配置如下:
<sessionState cookieless="UseCookies" mode="StateServer" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" stateConnectionString="tcpip=127.0.0.1:42424" timeout="20" />
我已经仔细检查了 ASP.NET 状态服务器是否已启动并正在运行。我还检查了 ASP.NET 状态服务器是否在端口 42424 上运行。事实上,有时可以。我的 IIS 应用程序池是 .NET 4 集成管道。
我还检查了 Microsoft 的这篇文章,建议增加 stateNetworkTimeout。但对我来说似乎不是一个好的解决方案,因为服务器负载不重。
当我转到事件查看器时,我看到以下警告:
Event code: 3009
Event message: Unable to make the session state request to the session state server. Details: last phase='Sending request to the state server', error code=0x80072749, size of outgoing data=0
Event time: 8/27/2014 4:38:04 PM
Event time (UTC): 8/27/2014 2:38:04 PM
Event ID: 848eadc753cf4e99aee72824d1d7fc85
Event sequence: 239
Event occurrence: 12
Event detail code: 50016
Application information:
Application domain: /LM/W3SVC/2/ROOT/download-7-130536222982810000
Trust level: Full
Application Virtual Path: /download
Application Path: C:\inetpub\vhosts\plasticscm.com\httpdocs\download\
Machine name: main
Process information:
Process ID: 4124
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
Exception information:
Exception type: HttpException
Exception 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.
我可以做些什么来进一步调查这个问题?