Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Service 卸载前停止服务和受保护的应用程序_Service_Wix_Uninstallation - Fatal编程技术网

Service 卸载前停止服务和受保护的应用程序

Service 卸载前停止服务和受保护的应用程序,service,wix,uninstallation,Service,Wix,Uninstallation,我有一个服务MyService.exe,它正在监视我的应用程序MyApp.exe,这意味着它会在应用程序崩溃时启动应用程序。基本上,当服务停止时,应用程序停止(由服务停止),当服务启动时,应用程序由服务启动 为了停止我的服务,并在卸载时停止我的应用程序,我正在执行以下操作: <ServiceControl Id='MyServiceControl' Name='MyServiceForTest' Start='install' Stop='uninstall' Remove='uninst

我有一个服务MyService.exe,它正在监视我的应用程序MyApp.exe,这意味着它会在应用程序崩溃时启动应用程序。基本上,当服务停止时,应用程序停止(由服务停止),当服务启动时,应用程序由服务启动

为了停止我的服务,并在卸载时停止我的应用程序,我正在执行以下操作:

<ServiceControl Id='MyServiceControl' Name='MyServiceForTest' Start='install' Stop='uninstall' Remove='uninstall'/>

但当我想卸载所有内容时,会收到错误消息:“安装程序必须更新系统运行时无法更新的文件或服务。如果选择继续,则需要重新启动才能完成安装。”。如果在运行卸载程序之前手动停止服务,我不会收到此消息,因为我的服务和应用程序都不再运行

在日志文件中,我注意到这种情况发生在InstallValidate中,我收到一条消息,MyApp.exe的b/c正在运行

我认为发生的情况是:卸载程序检查正在运行的应用程序,它注意到MyService.exe和MyApp.exe都在运行,可能检测到MyService.exe将按照指示由卸载程序本身停止,但不知道MyApp.exe,一旦服务停止,它也会被终止,因此会显示重新启动消息

我不能从卸载程序b/c关闭MyApp.exe,服务将再次重新启动

如何解决此问题,以便用户在执行卸载/升级之前不需要重新启动或手动停止服务?此外,我无法再更改MyService和MyApp代码,因此我只能从(联合国)安装程序中执行此操作

蒂亚,
Viv

我将在您的服务中公开一种机制,在这种机制中,您的安装程序可以指示它停止运行并终止应用程序。这样,当Windows Installer查找锁定的文件时,它找不到任何文件。

如前所述,我无法再更改服务中的代码。在InstallValidate调用“net stop MyService”之前,我是否可以执行一个自定义操作?这是正确的吗?这样,在安装程序查找正在使用的文件之前,我将停止服务。祝你好运。当开发人员告诉我他们的代码已经“完成”,而安装程序只需要“使其工作”,事情通常不会有好的结局。