2012-03-07 96 views
4

我有一個應用程序,無需出席24/7全天候運行。它通過ClickOnce進行部署,需要自行檢查和下載更新。它在應用程序啓動時以及在晚上的預定時間檢查更新。當它在啓動時執行時,它工作得很好。ClickOnce部署CheckForDetailedUpdate拋出一個異常

但是,當它在預定時間完成時,它會崩潰。在這兩種情況下,它都使用完全相同的代碼。它運行在Windows   7並且可能與UAC有關。我在想,當電腦處於空閒狀態時,它可能無法訪問文件系統?我真的需要解決這個問題。以下是異常的詳細信息:

消息:

,服務需要才能正常不 服務帳戶配置存在的特權。您可以使用服務 Microsoft管理控制檯(MMC)管理單元(services.msc)和 本地安全設置MMC管理單元(secpol.msc)查看服務 配置和帳戶配置。 (異常來自HRESULT: 0x80070511)

堆棧跟蹤:

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() 

編輯:我覺得原因可能是硬盤驅動器系統處於待機狀態一段時間後關閉。有沒有辦法在我檢查更新(使用C#)之前以編程方式打開硬盤驅動器?

+0

打開計劃任務的屬性對話框。有一個名爲'在運行任務時使用以下用戶帳戶的設置:'。您的用戶帳戶是否被選中?如果不是,那麼這可能是問題的原因。將其更改爲您的帳戶,我相信它可以解決問題。 – RLH 2012-03-07 20:03:17

+0

我遇到與檢測更新和自動重新啓動的GUI應用程序相同的問題。每次一次又一次,它會在重新啓動時崩潰,這個錯誤。由於它以交互方式運行,它(應該)正在使用具有系統管理特權的當前用戶帳戶。 – Newtopian 2012-04-19 19:11:21

+0

您使用的是什麼版本的Visual Studio? – 2013-11-16 18:34:53

回答

4

我會把這個鏈接只是爲了記錄:link to MSDN forum。據它說,這是ClickOnce內部的一個錯誤,它會在經過一定次數的CheckForDetailedUpdate()函數調用後出現這個錯誤。