How to recycle the application pool at specific times on business days?

Is it possible to schedule a reload of the application pool at a specific time only on business days?

Thanks in advance!

+4
source share
4 answers

If you cannot configure the desired schedule using IIS directly, you can create a scheduled task that invokes

c:\Windows\system32\inetsrv\appcmd.exe recycle apppool "NameOfTheAppPool" 

at the required times.

+4
source

If you are using IIS 7, the PeriodicRestart key. Add the following to your ApplicationHost.config file:

 <add name="YourApplicationPool"> <recycling logEventOnRecycle="Schedule"> <periodicRestart> <schedule> <clear /> <add value="12:00:00" /> </schedule> </periodicRestart> </recycling> <processModel identityType="NetworkService" shutdownTimeLimit="00:00:30" startupTimeLimit="00:00:30" /> </add> 

It will recycle your Application Pool every 12 hours.

If you are using IIS7, you can configure the Scheduled Task in business days by running the following command:

appcmd.exe recycle apppool "YourApplicationPool"

If you are using IIS6, I will follow the guide here .

+3
source

This documentation shows how to use the application pool utility settings.

 <add name="Contoso"> <recycling logEventOnRecycle="Schedule"> <periodicRestart> <schedule> <clear /> <add value="03:00:00" /> </schedule> </periodicRestart> </recycling> <processModel identityType="NetworkService" shutdownTimeLimit="00:00:30" startupTimeLimit="00:00:30" /> </add> 
+2
source

If you host in Azure, you can use the startup.cmd file with the following (from here ):

 REM Prevent unwanted recycling %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00 %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.recycling.periodicRestart.time:00:00:00 REM Recycle every day at 4am %windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/applicationPools /+applicationPoolDefaults.recycling.periodicRestart.schedule.[value='04:00:00'] /commit:apphost 
0
source

Source: https://habr.com/ru/post/1398840/


All Articles