避免会话变量时的web.config及bin文件夹的变化损失 [英] Avoiding loss of session variables when web.config and bin folder changes

查看:181
本文介绍了避免会话变量时的web.config及bin文件夹的变化损失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个ASP.net网站,我使用会话变量。但客户使用我的网站的时候,如果我改变web.config中,然后它会导致应用程序池重新启动,所有会话丢失。

We have a ASP.net website and I use session variables. But when customer was using my website, If i change the web.config then it causes application pool to restart and all sessions gets lost.

现在在我的情况该网站是从客户提交查询。所以一旦他提交页面或形式从客户的数据将被写入到我们的数据库。现在所有,如客户数的信息,名称等,都将丢失,只有他的问题(这是不是一个会话变量)将被提交。因此,我们得到的只是查询,并没有相关的信息谁张贴了它。因此,它成为我们找到谁发布了这一个严重的问题。

Now in my case the website is for submitting query from customers. So the data from customer will be written to our database once he submits the page or form. Now all the information like customer number ,name etc will be lost and only his query(which is not a session variable) will be submitted. So we get only query and no information related who has posted it. So it becomes a serious problem for us to find who has posted it.

另外,如果我改变bin文件夹中的文件,然后它会导致同样的问题?
那么,什么是最好的方案来解决这个问题呢?

Also if I change the bin folder files then does it cause the same problem? So what are the best solutions for this problem?

推荐答案

是的,这是预期的内存中会话状态的行为 - 的IIS重新启动或应用程序池或应用程序域的回收再循环将杀死的状态。即改变的web.config 或者在现场接触足够的文件(包括bin文件夹)会导致应用程序域回收通过内置在ASP.Net逻辑。

Yes, it is expected behavior for in-memory session state - restarts of IIS or recycle of application pool or recycle of app domain will kill the state. I.e. changing web.config or touching enough files in the site (including bin folder) will lead to app-domain recycle by built in ASP.Net logic.

要解决它使用了进程外ASP.Net SQL会话状态:建立SQL会话状态或国家的服务,也有很多其他的实施ASP.Net会话状态

To solve it use out-of-process ASP.Net SQL session state: build in SQL session state or state service, there are also many other implementation of session state for ASP.Net.

这篇关于避免会话变量时的web.config及bin文件夹的变化损失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆