In Inno setup script how to set advance settings for IIS application pool? I'm specifically looking for setting Idle Time-out property? I was not able to find and helpful information related to setting up IIS or deploying website Inno Setup product help page
Here's screen capture of advance property from IIS :
Following is a snippet of where I create application pool:
{Configure IIS website}
procedure ConfigureIISWebsite();
begin
try
AppPool.Stop();
// Connect to the IIS server.
WebService := IIS.GetObject('IIsWebService', '{#IISServerName}' + '/w3svc');
// Get the website.
WebServer := WebService.GetObject('IIsWebServer', '{#IISServerNumber}');
WebRoot := WebServer.GetObject('IIsWebVirtualDir', 'Root');
except
end;
end;
{Configure App pool}
function ConfigureAppPool(): Boolean;
begin
// Read values into variables
Result := True;
ApplicationName := InputAppNamePage.Values[0];
VirtualDirectory := InputAppNamePage.Values[0];
IISApplicationPoolName := InputAppNamePage.Values[0];
// Create the application pool.
try
AppPool := AppPools.Create('IIsApplicationPool', IISApplicationPoolName);
AppPool.ManagedPipelineMode := '{#APPPOOL_MANAGED_PIPELINE_MODE}';
AppPool.ManagedRuntimeVersion := '';
AppPool.SetInfo();
ConfigureIISWebsite();
except
Log('Failed to create an application pool.');
Result := False;
Exit;
end;
end;
end;
Would appreciate if someone can point me to any helpful resource or code snippet.
Based off suggestion from @MartinPrikryl following is what worked for my use case :
AppPool.IdleTimeout := '0'; // 0 value means infinite
While exploring this I was also able to achieve same by using following ways :
NOTE : Run installer with appropriate administrative privileges.
1) Using [Registry] section :
[Registry]
; Modify Idle Time-out for an IIS application pool
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\IIS\{IIS Version}\AppPools\{YourAppPoolName}"; ValueType: dword; ValueName: "IdleTimeout"; ValueData: {time in seconds}
Replace the following placeholders with appropriate values:
2) Using [Run] section :
[Run]
Filename:{sys}\inetsrv\appcmd.exe; Parameters:"set apppool /apppool.name:YourAppPoolName /processModel.idleTimeout:00:30:00"; Flags: runhidden
Replace the following placeholders with appropriate values:
Hope this helps others in future.