简体   繁体   English

IIS7和经典ASP会话

[英]IIS7 and Classic ASP Sessions

I've got an old web app written in Classic ASP which used to run on an IIS6 server no problem, then long story short, I moved it onto a Linux server running SunOne ASP which also worked fine (after a couple of minor tweaks), and now in a bid to access some 3rd party COM controls the app originally used, I've moved it back again to a Windows server, this time 2008 running IIS7. 我有一个用经典ASP编写的旧的Web应用程序,曾经在IIS6服务器上运行没有问题,然后长话短说,我把它移动到运行SunOne ASP的Linux服务器上也运行良好(经过一些小的调整后) ,现在为了访问一些第三方COM控件最初使用的应用程序,我已经将它再次移回到Windows服务器,这次运行IIS7。

On the whole the app works fine, but there seems to be a random problem now with the session variables getting lost. 总体而言,该应用程序运行良好,但现在似乎有一个随机问题,会话变量丢失。 The implication of this is that the user gets automatically logged out of the system. 这意味着用户会自动退出系统。

It's all pretty simple stuff, and just uses the a session variable to hold the logged in status (as well as a couple of other bits and pieces). 这一切都非常简单,只需使用会话变量来保存登录状态(以及其他几个部分)。

If Session("login_status") <> "loggedin" Then 
 Response.Status="302 Object moved"
 Response.Redirect "/admin/default.asp"
End If

The app is running on a shared hosting server, and what I'm worried about more than anything else is why this is happening, mostly so if I have to host any other ASP apps on the same platform I'm not going to run into similar problems. 该应用程序在共享托管服务器上运行,而我最担心的是为什么会发生这种情况,主要是因为如果我必须在同一平台上托管任何其他ASP应用程序,我将不会遇到类似的问题。

Could this be because IIS7 is recycling the application pool and wiping out any session data in the process? 这可能是因为IIS7正在回收应用程序池并消除过程中的任何会话数据吗? And if that's the case, what could be done about it, short of course of writing my own state management/session handler routine, which is next on the cards if all else fails? 如果是这样的话,那么可以做些什么呢,不能编写我自己的状态管理/会话处理程序例程,如果所有其他方法都失败了,那么这就是卡片的下一步呢?

thanks for your hint regarding the (IIS 7.5) 'application pool's (advanced settings) -> Idle Time-out (group: Process Model)'! 感谢您关于(IIS 7.5)'应用程序池(高级设置) - >空闲超时(组:过程模型)'的提示!

For my Classic ASP site that lost the current session all the time the individual application pool it uses for 'Idle Time-out (minutes)' had a (default?) setting of 5 minutes. 对于我的经典ASP站点,它一直丢失当前会话,它用于“空闲超时(分钟)”的单个应用程序池的(默认?)设置为5分钟。 I changed this to a higher value and it seems fine now. 我将此更改为更高的值,现在看起来很好。 As this currently is a test system with me as the only test user causing traffic the "Idle Time-Out" seemed to apply after me doing nothing on the site for longer than 5 minutes. 由于目前这是一个测试系统,我是唯一一个导致流量的测试用户,因此“空闲超时”似乎适用于我在网站上不做任何事情超过5分钟。

regards ASDev 关于ASDev

You should be sure you're not running a web garden where no garden is wanted. 你应该确定你没有经营一个没有花园的网络花园。 In your App Pool settings, under Process Model, look at "Maximum Worker Processes". 在“应用程序池”设置中的“处理模型”下,查看“最大工作进程数”。 If the value is greater than "1", you may have the issue you describe. 如果该值大于“1”,则可能是您描述的问题。 I know I did. 我知道我做到了。

Read about Web Gardens here: http://geekswithblogs.net/vkamat/archive/2004/11/17/15145.aspx 在这里阅读Web Gardens: http//geekswithblogs.net/vkamat/archive/2004/11/17/15145.aspx

You should talk to your hosting company. 你应该和你的托管公司谈谈。 It sounds very much like your pool is a being recycled. 这听起来非常像你的游泳池被回收。 The host ought to keep a log of these and the reason that they were generated. 主持人应该记录这些以及它们产生的原因。

You should also ask whether you site shares a pool with other sites. 您还应该询问您的站点是否与其他站点共享池。

Not sure if it's applicable in this instance, but if you're running on IIS7 and redirecting between SSL and non SSL pages there may be different sessions in classic depending on the site configuration properties. 不确定它是否适用于此实例,但如果您在IIS7上运行并在SSL和非SSL页面之间重定向,则可能会有不同的经典会话,具体取决于站点配置属性。 In IIS, review the "ASP" section "Session Properties" - there will be a setting for "New ID on Secure Connection" that may be the culprit. 在IIS中,查看“ASP”部分“会话属性” - 将有一个“安全连接上的新ID”的设置可能是罪魁祸首。

This happened to me! 这发生在我身上! It was solved by setting the property Maximum Worker Processes to the value 1 in an application pool in IIS. 通过在IIS中的应用程序池中将属性Maximum Worker Processes设置为值1来解决此问题。

Could be the worker process getting recycled but that should only happen intermittantly not regularly (ie every 12 hours or earlier if the server is getting hammered). 可能是工作流程被回收,但这应该只是间歇性地发生(例如,如果服务器受到重创,则每12小时或更早)。

Long shot but are you using IE8 when you get the problem, we've had a similar problem with IE8 dropping cookies and for now we've been sending the "behave like ie7" header that you can send down with the request (ASP with JScript btw): 远远的,但是当你遇到问题时你使用的是IE8,我们在使用IE8删除cookie时遇到了类似的问题,现在我们一直在发送“行为类似于ie7”的标题,你可以发送请求(ASP与JScript btw):

// Force IE8 to act as IE7...grumble
Response.AddHeader( "X-UA-Compatible", "IE=EmulateIE7" );

And in the head of all our page: 在我们所有页面的头部:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>

This might be a red herring though 这可能是一个红鲱鱼

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM