错误信息如下:

在发布ASP.NET网站的时候,出现state server错误:
Server Error in '/' Application.
--------------------------------------------------------------------------------
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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: 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.

中文翻译:

无法向会话状态服务器发出会话状态请求。
请确保 ASP.NET State Service (ASP.NET 状态服务)已启动,并且客户端端口与服务器端口相同。
如果服务器位于远程计算机上,请检查 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection 的值,
确保服务器接受远程请求。如果服务器位于本地计算机上,并且上面提到的注册表值不存在或者设置为 ,
则状态服务器连接字符串必须使用“localhost”或“127.0.0.1”作为服务器名称。

解决方案:

出现这种错误的原因,一般可以归纳为一下几点:

1、ASP.NET State Server 服务关闭了,开启即可。
     ASP.NET State Server服务默认是手动开启的, 所以很多时候在服务器重启后,ASP.NET State Server 服务其实是停止状态的,最好将该服务设成自动启动。

2、HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection的值不为1,确保服务器能接受远程请求。
    AllowRemoteConnection 的键值设置成“1”后,意味着允许远程电脑的连接,也就是说只要知道你的服务端口,就可享用你的ASP.NET State Service,即把 Session 存放在服务器进程内,但这样会导致安全性减弱。

3、42424端口被其他程序占用或者没有开启,因为42424端口是将session存在服务器进程必须的。

4、设成StateServer 后,必须要有对应的stateConnectionString 。
     Web.config中<sessionState> 节点内容应该设置成类似下面内容:
     <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="300"/>

5、防火墙问题:添加42424端口的出站、入站规则

6、如果还是不行的话,ping一下你的远程status服务器,看是否能通吧.

完美解决!!

最新文章

  1. 安卓学习-- RecyclerView简单入门
  2. codevs1183泥泞的道路
  3. java跳出外部循环
  4. C# 文件夹加密
  5. ubuntu java jdk安装及环境变量设置
  6. 图片grayscale(灰阶效果)webkit内核支持。
  7. 通过 ANE(Adobe Native Extension) 启动Andriod服务 推送消息(一)
  8. visual studio 未将对象引用设置到对象的实例
  9. 【IOS学习基础】文件相关
  10. 点评阿里JAVA手册之编程规约(OOP 规约 、集合处理 、并发处理 、其他)
  11. 关于虚拟机打开ubuntu黑屏的问题
  12. Java框架spring 学习笔记(一):SpringBean、ApplicationContext 容器、BeanFactory容器
  13. 在Centos7下安装nghttp2
  14. Android控件第5类——ViewAnimator
  15. 【题解】bzoj 4478 [Jsoi2013]侦探jyy
  16. jmap -histo pid 输出的[C [B [I [S 的含义
  17. ‘’.join(列表)--列表转化为一个语句。 strip()删除掉str中的左右的空白字符
  18. 类实例化对象可以访问静态(static)方法,但是不能访问静态属性。
  19. Python 面试题集锦【315+道题】
  20. VcCallC#_02

热门文章

  1. contextlib:上下文管理器工具
  2. js动态添加控件(输入框为例)
  3. Alpha版本第一周小结
  4. Java语言基础(7)
  5. java 多线程,线程安全等定义
  6. java8学习之Optional深入详解
  7. kotlin默认参数和具名参数
  8. Rails 用Webpack安装Bootstrap(附录webpack使用)
  9. Linux Tomcat 文件上传异常
  10. Jmeter+ant+Jenkins接口自动化框架搭建