热门文章
 
自动备份IIS配置的实现方法
IIS的安装与配置
Win XP家用版安装 II
IIS 安装配置基础
windows 2003系统
windows 2003系统
windows 2003系统
windows 2003系统
windows XP 安装
Win2000如何IIS
 推荐文章
 
微软教程:SMTP 文件夹所
微软教程:为 IIS 5 分
精心配置IIS打造安全Web
自动备份IIS配置的实现方法
Win XP家用版安装 II
防止别人用ipc$和默认共享
IIS 安装配置基础
windows 2003系统
windows 2003系统
windows 2003系统
windows 2003系统
windows XP 安装
Win2000如何IIS
IIS配置文件后门
配置asp.net环境
IIS 6.0 中的 Web
 
你现在的位置:您现在的位置是: 中国ASP>>ASP与服务器>>IIS配置
定期回收 ASP.net

问:

我们在 IIS 5 服务器上安装了 ASP.net,以通过 Web 提供 .NET 应用程序。这个应用程序运行得很好,只是 aspnet_wp.exe 进程消耗过多的内存,并会被 ASP.net 定期回收。我们喜欢回收功能,但是我们希望可以定期回收 ASP.net,而不是等到内存很低后才进行回收。在 IIS 5 中,我们通常使用 IIS 5 进程回收工具完成此操作。我们该如何让 ASP.net 也和IIS 5 进程回收工具一样,按设定的时间执行回收操作。

答:

IIS 5 进程回收工具 (英文)是一个非常有用的工具,有了它,您可以将 IIS 5 配置为根据 http gets 的数量、时间、内存消耗量以及其他参数重新启动。这个工具是在发布 ASP.net 前开发的,因此它根本无法识别 aspnet_wp.exe 这个在 IIS 5 服务器上运行 ASP.net 应用程序的文件。然而,当使用进程回收工具、IISRESET 以及任何其他方法回收 IIS 时,ASP.net 也会重新启动;不过您还可以使用内置在 ASP.net 中的配置元素,单独回收 ASP.net。

这可以通过 ASP.net 的 web.config 文件中的进程配置设置来实现。默认情况下,web.config 位于 %systemroot%\Microsoft.Net\Framework\v<version number>\CONFIG 目录中。它是一个 XML 文件,您可以使用记事本等文本编辑器来打开和编辑它。打开这个文件并搜索“processmodel"。这将定位到进程模式配置部分,其中包含以下具有注释内容的节:

<!--
processModel Attributes: enable="[true|false]" - Enable process Model
timeout="[Infinite | HH:MM:SS]" - Total life of process, once expired process is shutdown and a new process is created
idleTimeout="[Infinite | HH:MM:SS]" - Total idle life of process, once expired process is automatically shutdown
shutdownTimeout="[Infinite | HH:MM:SS]" - Time process is given to shutdown gracefully before being killed
requestLimit="[Infinite | number]" - Total number of requests to serve before process is shutdown
requestQueueLimit="[Infinite | number]" - Number of queued requests allowed before process is shutdown
restartQueueLimit="[Infinite | number]" - Number of requests kept in queue while process is restarting
memoryLimit="[number]" - Represents percentage of physical memory process is allowed to use before process is recycled
webGarden="[true|false]" - Determines whether a process should be affinitized with a particular CPU
cpuMask="[bit mask]" - Controls number of available CPUs available for ASP.NET processes (webGarden must be set to true)
userName="[user]" - Windows user to run the process as.
Special users: "SYSTEM": run as localsystem (high privilege admin) account.v "machine": run as low privilege user account named "ASPNET".
Other users: If domain is not specified, current machine name is assumed to be the domain name.
password="[AutoGenerate | password]" - Password of windows user. For special users (SYSTEM and machine), specify "AutoGenerate".
logLevel="[All|None|Errors]" - Event types logged to the event log
clientConnectedCheck="[HH:MM:SS]" - Time a request is left in the queue before ASP.NET does a client connected check
comAuthenticationLevel="[Default|None|Connect|Call|Pkt|PktIntegrity|PktPrivacy]" - Level of authentication for DCOM security
comImpersonationLevel="[Default|Anonymous|Identify|Impersonate|Delegate]" - Authentication level for COM security
responseDeadlockInterval="[Infinite | HH:MM:SS]" - For deadlock detection, timeout for responses when there are executing requests.
responseRestartDeadlockInterval="[Infinite | HH:MM:SS]" - Time to wait between restarting WPs due to responseDeadlockInterval
maxWorkerThreads="[number]" - Maximum number of worker threads per CPU in the thread pool
maxIoThreads="[number]" - Maximum number of IO threads per CPU in the thread pool
serverErrorMessageFile="[filename]" - Customization for "Server Unavailable" message
When ASP.NET is running under IIS 6 in native mode, the IIS 6 process model is used and settings in this section are ignored.
Please use the IIS administrative UI to configure things like process identity and cycling for the IIS worker process for the desired application.
-->

注意,可以为上面的“timeout"变量设置一个单位为时、分、秒的值,这个值指定了 aspnet_wp.exe 进程的生存时间。当 ASP.net 启动 aspnet_wp.exe(它在首次启动时调用一个需要 ASP.net 的页面)时,该计时器开始计时。当 asnet_wp.exe 进程“活着"的时间等于超时值时,将会被回收。

尽管这不同于设定一个日期和时间来回收 ASP.net 进程,但是这可以实现定期回收,并且可以保证应用程序的正常运行。另外,您可以控制这个回收操作的其他方面,例如在工作进程不再使用时关闭它(从而实现在非高峰期执行回收操作)。


相关信息:

IIS 安装配置基础
Win XP家用版安装 IIS
windows 2003系统安装 和安全配置 1
windows 2003系统安装 和安全配置 2
windows 2003系统安装 和安全配置3
windows 2003系统安装 和安全配置4
windows XP 安装 iis
Win2000如何IIS

 

中国ASP技术 ASP.ORG.CN 版权所有 2004-2008