通过命令行设置默认应用程序池回收 [英] Set default app pool recycling via command line

查看:1263
本文介绍了通过命令行设置默认应用程序池回收的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Azure Web角色的开头执行以下命令,以设置应用程序池将被回收的特定时间:

I'm trying to execute the following command at the start of an Azure web role to set a specific time in which the app pool will be recycled:

%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.recycling.periodicRestart.schedule.[value='00:08:00']

但当我这样做时,我收到错误:

But when I to do this I get the error:

ERROR ( messsage:Cannot find requested collection element. )

任何人都知道如何使用appcmd设置默认应用程序池设置,使其在UTC时间上午8:00回收?请注意,应用程序池回收的特定时间的集合最初为空。

Anyone know how to use appcmd to set default application pool settings to make it recycle at 8:00 AM UTC? Note that the collection of specific times the app pool recycles is empty initially.

推荐答案

我在一段时间后重新启动应用程序池,而不是在一天中的某些时间。虽然你的尝试表明你有点做同样的事情?但那表明你试图每8分钟重启一次应用程序池?无论如何这就是我使用的:

I restart application pools after periods of time, not at certain times of the day. Although your attempt suggests you are kind of doing the same? But that would suggest you are attempting to restart the app pool every 8 minutes? Anyway This is what I use:

appcmd set apppool /apppool.name: string /recycling.periodicRestart.time: ' timeSpan '

其中 string 是应用程序池名称和 timeSpan 是d.hh:mm:ss。

Where string is the application pool name and timeSpan is d.hh:mm:ss.

工作示例在IIS7中每30分钟重新启动一次defaultapplicationpool:

Working Example to restart the defaultapplicationpool every 30 minutes in IIS7:

appcmd set apppool /apppool.name: defaultapplicationpool /recycling.periodicRestart.time: 00:30:00

编辑

根据您的评论不仅可以吗?

In light of your comment can you not just do this?

appcmd set apppool /apppool.name: string /+recycling.periodicRestart.schedule.[value=' timeSpan ']

编辑2

每天上午00:08回收的默认应用程序池示例

Example of Default App Pool to recycle daily at 00:08am

appcmd set apppool /apppool.name: DefaultAppPool /+recycling.periodicRestart.schedule.[value='00:08:00']

这篇关于通过命令行设置默认应用程序池回收的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆