【发布时间】:2012-03-25 02:53:48
【问题描述】:
我有一个应用程序在无人值守的情况下 24/7 全天候运行。它通过ClickOnce 部署,需要自行检查和下载更新。它会在应用程序启动时和晚上的预定时间检查更新。当它在启动时运行时,它工作得非常好。
但是,当它在预定时间执行时,它会崩溃。在这两种情况下,它都使用完全相同的代码。它在 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#)?
【问题讨论】:
-
打开计划任务的属性对话框。有一个名为
When running the task, use the following user account:的设置。是否选择了您的用户帐户?如果不是,那么这可能是问题的原因。将其更改为您的帐户,我相信它会解决问题。 -
我对检测更新和自重启的 GUI 应用程序有同样的问题。一次又一次,它会在重新启动时因这个错误而崩溃。由于它以交互方式运行,因此(应该)使用对系统具有管理权限的当前用户帐户。
-
您使用的是什么版本的 Visual Studio?
-
我认为是 2010 年,但我将无法再重现该问题。
标签: .net deployment windows-7 clickonce uac