Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClickOnce deployment CheckForDetailedUpdate throws an exception

I have an application that's running 24/7 without attendance. It's deployed via ClickOnce and needs to check and download updates by itself. It checks for updates at application startup and at scheduled time at night. When it does it on startup, it works perfectly fine.

However, when it does it at scheduled time, it crashes. In both cases it's using exactly the same piece of code. It's running under Windows 7 and might have something to do with UAC. I'm thinking that maybe it cannot access file system when computer is at idle state? I really need to fix that. Here are the exception details:

Message:

A privilege that the service requires to function properly does not exist in the service account configuration. You may use the Services Microsoft Management Console (MMC) snap-in (services.msc) and the Local Security Settings MMC snap-in (secpol.msc) to view the service configuration and the account configuration. (Exception from HRESULT: 0x80070511)

Stack trace:

at System.Deployment.Internal.Isolation.IStore.GetAssemblyInformation(UInt32 Flags, IDefinitionIdentity DefinitionIdentity, Guid& riid)
at System.Deployment.Internal.Isolation.Store.GetAssemblyManifest(UInt32 Flags, IDefinitionIdentity DefinitionIdentity)
   at System.Deployment.Application.ComponentStore.GetAssemblyManifest(DefinitionIdentity asmId)
   at System.Deployment.Application.ComponentStore.GetSubscriptionStateInternal(DefinitionIdentity subId)
   at System.Deployment.Application.SubscriptionStore.GetSubscriptionStateInternal(SubscriptionState subState)
   at System.Deployment.Application.DeploymentManager.BindCoreWithAppId(Boolean blocking, FileStream& refTransaction, String& productName)
   at System.Deployment.Application.DeploymentManager.BindCore(Boolean blocking, TempFile& tempDeploy, TempDirectory& tempAppDir, FileStream& refTransaction, String& productName)
   at System.Deployment.Application.DeploymentManager.Bind()
   at System.Deployment.Application.ApplicationDeployment.CheckForDetailedUpdate(Boolean persistUpdateCheckResult)
   at AdvancedKiosks.Utils.Updating.Updater.get_UpdateAvailabilityStatus()
   at AdvancedKiosks.Utils.Updating.Updater.get_CanUpdate()
   at AdvancedKiosks.DKMS.ViewModel.MainViewModel.<.ctor>b__6()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

EDIT: I think the cause might be that the hard disk drive is turning off after some time of the system being idle. Is there a way to programatically turn on the hard disk drive before I check for updates (using C#)?

like image 799
Martynas Avatar asked Mar 07 '12 15:03

Martynas


1 Answers

I will put this link here just for the record: link to MSDN forum. According to it, it's a bug in ClickOnce internals which causes this error to appear after certain number of calls to the CheckForDetailedUpdate() function.

like image 150
avs099 Avatar answered Sep 21 '22 14:09

avs099