Set default app pool recycling via command line

亡梦爱人 提交于 2019-12-13 01:26:31

问题


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. )

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.


回答1:


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 '

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

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

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

EDIT

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

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

EDIT 2

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

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


来源:https://stackoverflow.com/questions/22489080/set-default-app-pool-recycling-via-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!