none 4.0下webconfig的sessionstate写法是否和2.0一样? RRS feed

  • 问题

  • 我现在使用asp.net4.0 visual studio 2010开发网页系统。在webconfig文件里写了sessionstae mode = "stateserver"的方式来保存session,写法和2.0的时候一样。问题是我写了timeout = "60" statenetworktimeout = "3600" 运行的时候没有异常,但是同事反映20分钟后会话就中断了需要重新登录系统。我对照了网上的写法没有什么不同。不知道是什么原因造成的。
    2013年12月24日 5:24


  • Hi,

    It should be the same with 2.0. But here is what we should check:

    1. If we use Form Authentication, there is an additional timeout setting defined in the web.config file for that as well. In system.web > authentication > forms node in the web.config and modify the "timeout" attribute to the desired minutes there as well.
    2. If we publish the webapp to iis, we also should configure iis Application Pool "idle Time-out" property.  In IIS (verion 7.5 for sure, maybe earlier but I can't confirm) right click on the associated Application Pool and select "Advanced Settings". Under the heading "Process Model" (expand if neccessary)  look for the setting "Idle Time-out (minutes)". Set this to the desired timeout in minutes.

    If it doesn't work for you, you can try changing the mode of storing the session to SQLServer which is not affected by worker process resets. For more information, you can refer here

    #adding a machineKey to fix state server mode

    Hope it can help you.

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href=""> HERE</a> to participate the survey.

    2013年12月25日 1:51