Iis provides the appcmd command to configure iis through the command line
The default path of appcmd.exe is c: \ windows \ system32 \ inetsrv \.
To Recycle an application pool, use the following syntax:
Appcmd recycle apppool/apppool. name: string
The variable string is the name of the application pool to be recycled. For example, to recycle the application pool named Marketing, type the following command at the command prompt and press Enter:
Appcmd recycle apppool/apppool. name: Marketing
Configuration
The process in this topic affects the following configuration elements:
To schedule a recycle application pool at a specific time, use the following syntax:
Appcmd set apppool/apppool. name: String/+ recycling. periodicRestart. schedule. [value = 'timespan ']
The string variable is the name of the application pool you want to configure. The format of the variable timeSpan is d. hh: mm: ss, where d indicates the number of days available, hh: mm: ss indicates the hour, minute, and second reading of the application pool.
The specified value must be in the 24-hour format.
To configure the application pool to be recycled at a specific interval, use the following syntax:
Appcmd set apppool/apppool. name: string/recycling. periodicRestart. time: 'timespan ']
The variable name is the name of the application pool to be configured. The format of the variable timeSpan is d. hh: mm: ss. d indicates the number of days available, hh: mm: ss indicates the number of hours, minutes, And seconds required to recycle the application. For example, to configure the application pool Marketing to be recycled every 30 minutes, type the following command at the command prompt and press Enter:
Appcmd set apppool/apppool. name: Marketing/recycling. periodicRestart. time: 00: 30: 00
Configuration
The process in this topic affects the following configuration elements:
Time attribute of the element
To configure the application pool to recycle a certain number of requests, use the following syntax:
Appcmd set apppool/apppool. name: string/recycling. periodicRestart. requests: uint
The string variable is the name of the application pool you want to configure. The variable uint is an unsigned integer used to specify the number of requests to be reached in the recycle application pool. For example, to configure the application pool named Marketing to recycle 55 requests, type the following command at the command prompt and press Enter:
Appcmd set apppool/apppool. name: Marketing/recycling. periodicRestart. requests: 55
Configuration
The process in this topic affects the following configuration elements:
The requests attribute of the element
To configure the application pool to recycle when it uses the specified amount of dedicated memory, use the following syntax:
Appcmd set config/section: applicationPools/[name = 'string']. reconfiguring. periodicRestart. privateMemory: uint
The string variable is the name of the application pool you want to configure. The uint variable is an unsigned integer used to specify the amount of dedicated memory (in KB) required for the application pool to be recycled ). For example, to configure the application pool named Marketing to recycle when it uses 2,000 KB of dedicated memory, type the following command at the command prompt and press Enter:
Appcmd set config/section: applicationPools/[name = 'marketing ']. reconfiguring. periodicRestart. privateMemory: 2000
Configuration
The process in this topic affects the following configuration elements:
The element's privateMemory attribute
To configure the application pool to recycle when the specified virtual memory threshold is reached, use the following syntax:
Appcmd set config/section: applicationPools/[name = 'string']. reconfiguring. periodicRestart. memory: uint
The string variable is the name of the application pool you want to configure. The uint variable is an unsigned integer used to specify the amount of virtual memory required by the application pool to be recycled (unit: KB ). For example, to configure the application pool Marketing to recycle after the virtual memory reaches 2,000 KB, type the following command at the command prompt and press Enter:
Appcmd set config/section: applicationPools/[name = 'marketing ']. reconfiguring. periodicRestart. memory: 2000
Configuration
The process in this topic affects the following configuration elements:
The memory attribute of the element.
To configure IIS to record events when an application pool is recycled due to unconfigured events, use the following syntax:
Appcmd set config/section: applicationPools/[name = 'string']. reconfiguring. logEventOnRecycle: ConfigChange | OnDemand | IsapiUnhealthy
The string variable is the name of the application pool you want to configure. For example, to configure IIS to record events when the application pool Marketing is in an abnormal state due to ISAPI extensions, type the following command at a command prompt and then press Enter:
Appcmd set config/section: applicationPools/[name = 'marketing ']. reconfiguring. logEventOnRecycle: IsapiUnhealthy
Configuration
The process in this topic affects the following configuration elements:
The logEventOnRecycle attribute of the element.