Freigeben über


A custom deployment of ClickOnce application starts the reinstallation process every time the user logs off and logs back again

While working on customer case, I came across an interesting issue with an application deployed using ClickOnce.

Issue Description:

A custom deployment of ClickOnce application starts the reinstallation process every time the user logs off and logs back again.

Cause:

We worked on the machine and found the following registry key that belongs to the ClickOnce isolation store was getting deleted during each logoff.

HKEY_CURRENT_USER\Software\Classes\Software\Microsoft\Windows\CurrentVersion\Deployment\SideBySide\2.0\PackageMetadata

When the user is logged in, a handle is created for the HKCU\Software\Classes hive, if a logoff could not unload this hive properly, it might get corrupted or hold incorrect data. This leads to get the corrupted data loaded back during logon.

In our case there was a problem with a single User Profile. These registry keys were getting removed or modified and was triggering the re-installation.

In a normal scenario, these registry keys do not get removed or modified, that provides the persistence to the application deployed using ClickOnce. In other words no re-installation occurs until there is a new update that is available and needs to be installed.

Possible Resolution

System processes and applications occasionally maintain connections to registry keys in the UserProfile, even after a user logs off. In such cases, the user session fails to end entirely. When you use roaming user profiles in a network environment, this can result in problems like deletion or modification of registry hives.

To resolve this problem, install Microsoft User Profile Hive Cleanup Service (UPHClean). UPHClean monitors the computer while you log off, and then UPHClean unloads UserProfiles. The User Profile Hive Cleanup service helps us to make sure that user sessions are completely ended when a user logs off. (https://msdn.microsoft.com/en-us/library/aa910532.aspx)

The User Profile Hive Cleanup service monitors for users who have logged off and for whom registry hives are still loaded. When this occurs, the service determines which applications have handles that are opened to the hives and releases them. It logs the application name and what registry keys were left open. After this occurs, the system finishes unloading the profile.

For more information and for installing User profile Hive cleanup service we recommend the following KB: https://support.microsoft.com/kb/837115

 

Content by: Ajith Thomas

Comments

  • Anonymous
    December 08, 2014
    Please update the links to info about the User Profile Hive Cleanup Service - both links are wrong. Thanks

  • Anonymous
    December 16, 2014
    Unfortunately "User Profile Hive Cleanup Service" (UPHClean Service) is only compatible with Windows XP and Server 2003. For Vista/Server 2008 and newer, the hive unload behavior has changed. I'm experimenting with the GPO setting DisableForceUnload = 1. Our issue cropped up when deploying WSUS, which was configured to automatically reboot the workstation after a period of time.  In our case, the forced reboot appears to be the precipitant of our hive corruptions. Check out this MSDN blog article for more info on the GPO: blogs.msdn.com/.../more-on-user-profile-service-functionality.aspx Hope I've helped, Jordan