gpt4 book ai didi

.net - 安装 ClickOnce 应用程序时出错

转载 作者:行者123 更新时间:2023-12-03 17:53:06 26 4
gpt4 key购买 nike

今天,每次用户尝试安装应用程序时,我都开始收到错误消息,我不知道为什么在部署了数月的 0 个问题之后我会得到这个,我没有更改与项目属性相关的任何内容,所有修改都与代码相关。

这是错误日志

PLATFORM VERSION INFO Windows : 10.0.15063.0 (Win32NT) Common Language Runtime : 4.0.30319.42000 System.Deployment.dll : 4.7.2046.0 built by: NET47REL1 clr.dll : 4.7.2101.1 built by: NET47REL1LAST dfdll.dll : 4.7.2046.0 built by: NET47REL1 dfshim.dll : 10.0.15063.0 (WinBuild.160101.0800)

SOURCES Deployment url : file:///Y:/RE/RentaEquipos.application Deployment Provider url : file://svrre/Repository/RE/RentaEquipos.application Application url : file://svrre/Repository/RE/Application%20Files/RentaEquipos_2017_07_10_8/RentaEquipos.exe.manifest

IDENTITIES Deployment Identity : RentaEquipos.application, Version=2017.7.10.8, Culture=es-CR, PublicKeyToken=0000000000000000, processorArchitecture=x86

APPLICATION SUMMARY * Installable application.

ERROR SUMMARY Below is a summary of the errors, details of these errors are listed later in the log. * Activation of Y:\RE\RentaEquipos.application resulted in exception. Following failure messages were detected: + Specified cast is not valid.

COMPONENT STORE TRANSACTION FAILURE SUMMARY No transaction error was detected.

WARNINGS * The manifest for this application does not have a signature. Signature validation will be ignored. * The manifest for this application does not have a signature. Signature validation will be ignored. * The manifest for this application does not have a signature. Signature validation will be ignored.

OPERATION PROGRESS STATUS * [26/7/2017 11:23:16] : Activation of Y:\RE\RentaEquipos.application has started. * [26/7/2017 11:23:16] : Processing of deployment manifest has successfully completed. * [26/7/2017 11:23:16] : Installation of the application has started.

ERROR DETAILS Following errors were detected during this operation. * [26/7/2017 11:23:16] System.InvalidCastException - Specified cast is not valid. - Source: System.Deployment - Stack trace: at System.Deployment.Application.DownloadManager.VerifyRequestedPrivilegesSupport(String requestedExecutionLevel) at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, > IDownloadNotification notification, DownloadOptions options, Uri& appSourceUri, String& appManifestPath) at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, > TempDirectory& downloadTemp) at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc) at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String > deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl, Uri& deploymentUri) at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(Uri activationUri, Boolean isShortcut, String textualSubId, String > deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(Uri activationUri, Boolean isShortcut, String textualSubId, String > deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl) at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

COMPONENT STORE TRANSACTION DETAILS No transaction information is available.

最佳答案

DownloadManager.VerifyRequestedPrivilegesSupport方法正在抛出 InvalidCastException .不幸的是,该类的代码在 ReferenceSource 上不可用。 ,但是当 System.Deployment.dlldecompiled ,罪魁祸首是明确的。反编译的方法如下所示:

private static void VerifyRequestedPrivilegesSupport(string requestedExecutionLevel)
{
Logger.AddMethodCall("VerifyRequestedPrivilegesSupport(" + requestedExecutionLevel + ") called.");
if (!PlatformSpecific.OnVistaOrAbove)
return;
bool flag = false;
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System");
if (registryKey != null && registryKey.GetValue("EnableLUA") != null)
{
Logger.AddInternalState("LUA policy key = " + registryKey.Name);
if ((int) registryKey.GetValue("EnableLUA") != 0)
{
flag = true;
Logger.AddInternalState("LUA is enabled.");
}
}
if (flag && (string.Compare(requestedExecutionLevel, "requireAdministrator", StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(requestedExecutionLevel, "highestAvailable", StringComparison.OrdinalIgnoreCase) == 0))
throw new InvalidDeploymentException(ExceptionTypes.UnsupportedElevetaionRequest, string.Format((IFormatProvider) CultureInfo.CurrentUICulture, Resources.GetString("Ex_ManifestExecutionLevelNotSupported"), new object[0]));
}

抛出异常的那一行是这样的:

if ((int) registryKey.GetValue("EnableLUA") != 0)

代码读取注册表项 \HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersio‌​n\Policies\System从 Windows 注册表。要抛出该异常, key 必须存在并且必须具有 EnableLUA值,但该值的类型必须不是整数。您需要运行 RegEdit.exe在出现错误的机器上,导航到注册表中的该键,并检查该值以查看它是什么。它应该显示 REG_DWORDType该值的列。如果没有,请将其删除并使用正确的类型重新添加。

关于.net - 安装 ClickOnce 应用程序时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45333956/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com