Matronix
Pilgrim

How to restart IIS7 automatically in install?

After I create my applications in IIS, my webservice is failing to pickup a dll in the GAC. The webservice doesn't start to work until I restart IIS. Is there a way to do this automatically in the install?

I see there is the "Restart Web Server After Configuring IIS" but it says "IIS 6 or earlier only"
Labels (1)
0 Kudos
1 Reply
DanCla
Pilgrim

Re: How to restart IIS7 automatically in install?

I use this in a InstallScript custom action:

function IISReset(hMSI)
STRING szProgram, szArgs;
NUMBER nvExitCode, nvResult, nvSize;
begin
if(GetEnvVar("windir", szProgram) < 0) then
MessageBox ("Environment variable windir not found.", SEVERE);
abort
endif;
// Declare paths
szProgram = szProgram^"system32\\iisreset.exe";
szArgs = "/RESTART";
//MessageBox (szProgram + "\n" + szArgs, INFORMATION); /* DEBUG */
nvResult = LaunchAppAndWait(szProgram, szArgs, WAIT);
nvExitCode = LAAW_PARAMETERS.nLaunchResult;
if (nvResult < ISERR_SUCCESS) then
MessageBox("iisreset.exe could not be launched",SEVERE);
else
if (nvExitCode != 0) then
MessageBox("iisreset.exe could not reset IIS",SEVERE);
endif;
endif;
end;
0 Kudos