动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > ASP.NET技巧
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ ASP.NET技巧 ]的信息

本月文章推荐
..NET 应用程序的性能提升应用技巧.
.ASP.NET 配置文件层次结构和继承.
.关于线程的参数、“返回值”、及.
.ASP.NET 2.0防止同一用户同时登陆.
.asp.net中执行存储数据操作时数据.
.SQL Server 不允许进行远程连接.
.使用函数传递参数来执行数据库操.
..NET框架2.0里的aspnet_compiler.
.UrlRewriter重写地址的POSTBACK后.
.在虚拟主机上用asp.net轻松实现u.
.编程实现QQ表情文件CFC格式.
.在Asp.net中为图像加入版权信息.
.提高ASP.NET性能的方法.
.ASP.NET常用的26个优化性能方法.
.Web导出Word需要添加头文件.
.ASP.NET中实现大结果集分页研讨.
.ASP.NET中编程杀死进程.
.ASP.NET 2.0运行时简要分析.
.编写简单的中文分词程序 .
.ASP.NET 2.0高级数据处理之数据绑.

小心!目录删除及重命名操作,一定丢失Session~~

发表日期:2007-1-29 |


如果你发现session突然无理由的丢失,而当你认真的检查代码并且排除其它常规可能丢失
的可能性时,你可能会像我一样,几乎要接近崩溃~!
后来发现问题出在我用代码创建一个临时目录然后删除临时目录的删除操作上。

现在和大家分享下:希望对碰到类似钉子的朋友有用。。

说白了session丢失实质就是:应用程序重起!

应用程序什么时候自动重起呢?

请参考:Anand在dotnetindia.com发表的文章

原文引用
{
Why ASP.NET Restarts?
Found this link from one of the blogs I was browsing today. This is ASP.NET Forum post by Patrick Y. Ng of MS.

This talks about both 1.0 and 1.1

This behaviour has been bugging lots of people. ASP.Net will restart its application for various reasons. All these reasons are legitimate, but the side effect is that the application will reset all its cache, application state, and InProc session states.
You can detect the restart of application and worker process by using the performance monitor. The counters to monitor are "ASP.NET\Application Restarts" and "ASP.NET\Worker Process Restarts".

For worker process restart, ASP.NET will write an entry in the eventlog to explain why (logLevel in controls how often eventlog is written).

For application restart, however, in v1 and v1.1 there is no easy way for a customer to figure out why a restart happened.

So by listing all reasons for app restart, I hope I can help some customers to understand and avoid the restart.

For v1
------
'http://www.knowsky.com
{
Things that causes application restart:

- The max compilation limit is reached (look for numRecompilesBeforeApprestart in machine.config)

- Physical application path of the web application has changed.

- Change in global.asax or one of the included files

- Change in machine.config

- Change in web.config in the app root

- Change inside bin directory or its subdirs

- A directory is renamed to bin, or bin is created

- Overwhelming change notifications – too many files are changed too fast in one of content directories – could happen if, for example, files are generated on the fly per request

- Change in the code-access security policy file
}

- The settings of various attributes in in machine.config affect the restart/shutdown of the worker process itself. However, if you use Windows 2003, and (by default) you are NOT using IIS5 isolation mode, is ignored. Instead, the settings in "Application Pools" in IIS manager is used.


For v1.1
--------
The list for v1.1 is the same as v1, with the following new conditions:

{
- User code called HttpRuntime.UnloadAppDomain

- Any directory under the web application folder is renamed
}
IIS 6.0
--------
If you're using IIS 6.0, and you're not using IIS 5 compatible mode, then aspnet_wp.exe will be replaced by w3svc.exe. You may want to go to IIS Manager, go to Application Pools/DefaultAppPool, and see if any of the parameters on the Recycling and Performance tabs are causing the IIS worker process (w3svc.exe) to shutdown.
}


也就是说 asp.net 会监视应用程序目录,一但有被监视
的动作发生(比如:修改了config、重命名目录等)应用程序就会自动重起
当然这时你的session一定丢失了。

如果避免不了这种操作(如:重命名目录);这里我们可以用cookie存信息或存到数据库去;

注意:除了以上列出的英文条件外。目录的删除操作一定丢失session。asp.net的内部机制对待目录有点像个守财奴,它死守着目录,你创建它不会管(往里加),一但创建他就会监视该目录,若你要删除或重命名它的(动它的目录),它就发生重起了。
http://www.cnblogs.com/qqcrazyer/archive/2007/01/27/632075.html

上一篇:ASP.NET 无法确保在注册的 JavaScript 内不存在重复定义 人气:3394
下一篇:.NET自动字符编码识别程序库 NChardet 人气:3577
浏览全部asp.net的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-10-12 team论坛 v2.0.4 bulid 080916 A
2008-10-12 Roclog v3.1.6
2008-10-12 SupeV v1.0.1 简体中文 GBK
2008-10-12 NetCMS v1.6.0.1010 正式版
2008-10-12 PHP考试系统PPFrame v1.2.7
2008-10-12 LPAS个人相册 v1.6.3
2008-10-12 快问仿百度知道系统 动态-静态-互
2008-10-12 方卡广告防点击系统 V1.0 GB2312
2008-10-12 泡菜内容管理系统[PCMS] v1.0 Bu
2008-10-11 联系人分组工具 v1.1 中文破解版
2008-10-11 FaceMelter变脸 v2.0 汉化破解版
2008-10-11 PathTracker道路跟踪仪 v1.2 破解
2008-10-11 Rooms手机聊天室 v0.6.7 破解版
2008-10-11 RemoteDesktop远程桌面 v1.0 破解
2008-10-11 ProRemote远程调音台 v1.0.1 破解
2008-10-11 PicShare照片共享 v1.0.0 破解版
2008-10-11 Photogene照片编辑器 v1.5 汉化破
2008-10-11 WriteRoom共享文档 v1.0 破解版
  发表评论
姓 名: 验证码:
内 容:
站长工具:网站收录查询 | Google PR查询 | ALEXA排名查询 | CSS在线编辑器 | 广告代码 | js/vbs加密 | md5加密 | 进制转换 | UTF-8 转换工具 | Html转换js | Html转换asp | Html转换php | Html转换perl
实用工具:汉字翻译拼音 | 拼音字典 | 符号对照表 | 个税计算 | 实时汇率查询换算 | 经典小工具 | 汉字简繁转换 | 普通单位换算 | 公制单位换算 | 生辰老黄历 | 国内电话区号 | 国家代码与域名缩写 | 文字加密解密 | 健康查询 | 万年历 | 汉字横竖排版 | 手机号码查询 | 计算器 | ip搜索
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報
防水工事·改修工事 フットサル大会 探偵
SEO対策 中国語教室 ホームページ作成