开发者

Upgrading Windows Service Automatically

I have an MSI which installs a windows service. I want the service to receive a message and be able to update itself. I have tried spinning off a new process which runs another assembly which in turns runs MSIEXEC with the /Uninstall flag and then installs a new MSI.

The issue here is that it appears to do nothing.. I have had a look at it appears to be an Admin privileges issue. I added a verb of 'runas' to enforce Admin rights: the MSI now开发者_StackOverflow中文版 runs but requires user interaction (which I don't want) to conform to UAC. Is it even possible to have this process fully automated or not?

Thanks.


Your approach is incorrect.

You don't need to uninstall the service package yourself, this should be handled by the new version. Windows Installer supports this by default through major upgrades.

Also, you cannot update a service while it's running. So your service should create a temporary file and launch a process. That temporary process can then handle the update (new version download and execution). Also, this temporary process should stop after the update and somehow delete its file.

It's is not as easy as it seems. This is why good Updater applications cost a lot of money.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜