ima-aa
Posts: 25
Joined: Mon Feb 03, 2014 2:37 pm

Insaller for Windows services waits a long time before copying files

Hello,

I have a question about an installer I created.

We have various Windows services that need to be installed on a server, which have been combined into a setup project.

I have an installer and, as a user, I can select which services I want to install. These are then installed and started immediately. This works very well. During an upgrade, it should stop the services, copy new files, and then restart them.
Previously, the services were uninstalled and then reinstalled. However, I would like it to only copy the files and not uninstall and reinstall the services, as the user has login accounts stored with the services.

This works very well in itself. The only thing is that after stopping the services, the installer waits quite a long time before it starts copying the files... Unfortunately, I don't know what it is waiting for. The services are terminated quickly and are immediately in a stopped state. I have terminated the virus scanner, etc.
When I uninstall the services and have them reinstalled, it works very quickly. I only have this problem when it is supposed to keep the existing ones (because of the login data).

Do you have any advice for me?

Thanks,
Andreas
Catalin
Posts: 7664
Joined: Wed Jun 13, 2018 7:49 am

Re: Insaller for Windows services waits a long time before copying files

Hello Andreas,

The delay you are seeing might be caused by Windows Installer's file-locking mechanism. When the services are stopped, the service processes may have exited, but the Windows Service Control Manager (SCM) and the MSI engine itself can hold file handles open on the service binaries for a period of time after the stop completes. MSI detects that the files are still locked and waits - by default up to several minutes - before proceeding with the file copy.

The entire workflow is controlled by Windows Installer and we have little control over that. Is this reproducible on every machine you are testing, or is it specific to one machine only?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ima-aa
Posts: 25
Joined: Mon Feb 03, 2014 2:37 pm

Re: Insaller for Windows services waits a long time before copying files

Thank you very much for explaining how it works. I’ll take a look at the whole thing...

I do have one more question about this installer, though. As I mentioned, it works quite well to install multiple services in a single installer and make the installation dependent on the configuration. "Services to install" and the "control operations" don’t cause me any problems. Now I have a requirement to configure a delayed start. I’ve seen that this is done via the "configure" operation. Unfortunately, I still have a problem here when I create a separate one for each individual service. Although the attached component is set the same as for the "Service to Install", it is still executed even if this component wasn’t selected during the installer setup. During the installation of our program, we therefore always get the message that the service cannot be configured—privileges are missing. The service simply wasn’t selected during installation.

Is there a way to change this behavior?

Thanks,
Andreas

Return to “Common Problems”