Chinaunix首页 | 论坛 | 博客
  • 博客访问: 836314
  • 博文数量: 190
  • 博客积分: 2991
  • 博客等级: 少校
  • 技术积分: 2400
  • 用 户 组: 普通用户
  • 注册时间: 2012-09-24 18:11
文章分类

全部博文(190)

文章存档

2015年(3)

2014年(1)

2013年(65)

2012年(121)

我的朋友

分类: 服务器与存储

2012-12-26 11:12:45

有时候发现IIS网站经常session丢失,用户被迫重新登陆网站。首先要确定这个网站是asp还是asp.net网站,IIS对于ASP和ASP.net的session配置在不同的地方。
 
对于ASP网站,session的控制在IIS Manager - Website Features - ASP - Services - Session Properties,通过这里的配置可以控制是否启用session,最大session数量以及session timeout时间等配置。
 
对于ASP.NET网站,session的控制在IIS Manager - Website Features - Session State,通过这里可以控制asp.net session相关的属性。
 
Session丢失可能是timeout造成也有可能存在其他原因。最常遇到的问题可能出在应用程序池重起。如果想判断是否是应用程序池重起造成的问题,可以通过IIS log或者Event Log来判断是否在发生问题的时间应用程序池发生过重起。
 
IIS log来判断的方式比较简单,
打开发生问题当天的IIS log,注意IIS log中记录的时间一般是UTC时间。如果IIS在某一时间发生过重起,那么log的头会重新写入,如下
 
#Software: Microsoft Internet Information Services 7.5
#Version: 1.0
#Date: 2012-11-09 05:05:00
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken
 
通过Event log来判断需要打开IIS Recycle Event logging,链接如下
logEventOnRecycle
 
打开之后应用程序池重起就会写入系统日志,直接查看系统日志即可。
 
应用程序池重起的原因多种多样,比如
 
Machine.Config, Web.Config or Global.asax are modified
The bin directory or its contents is modified
The number of re-compilations (aspx, ascx or asax) exceeds the limit specified by the setting in machine.config or web.config  (by default this is set to 15)
The physical path of the virtual directory is modified
The CAS policy is modified
The web service is restarted
(2.0 only) Application Sub-Directories are deleted (see Todd’s blog http://blogs.msdn.com/toddca/archive/2006/07/17/668412.aspx for more info)
阅读(1085) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~