IIS优化服务器性能导致QuartZ任务未运行

问题:

IIS 为优化服务器性能,会自动对它认为休眠的应用程序进行资源回收,资源回收将会导致网站应用程序关闭。

解决方案:

1、  设置闲置超时为0,固定回收时间间隔为0,即IIS不主动回收闲置进程

Ref:One way to conserve system resources is to configure idle time-out settings forthe worker processes in an application pool. When these settings are configured,a worker process will shut down after a specified period of inactivity. The default value for idle time-out is20 minutes.

Ifyou have a just a few sites on your server and you want them to always loadfast then set this to zero. 

 

2、并设置每天固定凌晨2:00(错开访问高峰)回收进程,且在虚拟内存和专用内存占用超过1G(服务器16G内存)时回收进程,防止内存溢出。设置1G是基于目前CRM工作线程内存占用普遍不高,便于内存溢出时及时回收进程

3、在进程被回收后,程序监测到应用关闭事件,重新启动应用

 

关于内存溢出的说明

.NET的GC机制有这样两个问题:

  首先,GC并不是能释放所有的资源。它不能自动释放非托管资源。

  第二,GC并不是实时性的,这将会造成系统性能上的瓶颈和不确定性。

GC并不是实时性的,这会造成系统性能上的瓶颈和不确定性。所以有了IDisposable接口,IDisposable接口定义了Dispose方法,这个方法用来供程序员显式调用以释放非托管资源。使用using语句可以简化资源管理。

非托管资源: 

  ApplicationContext,Brush, Component, ComponentDesigner, Container, Context, Cursor, FileStream,Font, Icon, Image, Matrix, Object, OdbcDataReader, OleDBDataReader, Pen, Regex,Socket, StreamWriter, Timer, Tooltip, 文件句柄, GDI资源, 数据库连接等等资源。

原文地址:https://www.cnblogs.com/proxyz/p/6109884.html