gpt4 book ai didi

c# - ClickOnce 无法运行 - 获取 'Specified Cast Not Valid'

转载 作者:太空宇宙 更新时间:2023-11-03 15:54:17 29 4
gpt4 key购买 nike

我有一个 C# 应用程序,我们在 Win7 机器上部署(使用 ClickOnce)没有任何问题(多年来),但我们有一些员工使用 Surface Pro 2 (8.1),并且该应用程序无法安装。当他们运行 setup.exe 时,他们会收到标准的“请联系您的管理员了解详细信息”错误。这是它生成的日志:

    PLATFORM VERSION INFO
Windows : 6.2.9200.0 (Win32NT)
Common Language Runtime : 4.0.30319.34014
System.Deployment.dll : 4.0.30319.33440 built by: FX45W81RTMREL
clr.dll : 4.0.30319.34014 built by: FX45W81RTMGDR
dfdll.dll : 4.0.30319.33440 built by: FX45W81RTMREL
dfshim.dll : 6.3.9600.16384 (winblue_rtm.130821-1623)

SOURCES
Deployment url : file://asc-server/public/Programs/Installs/SCS/SCS.application
Deployment Provider url : file://asc-server/public/Programs/Installs/SCS/SCS.application
Application url : file://asc-server/public/Programs/Installs/SCS/Application%20Files/SCS_3_4_0_9/SCS.exe.manifest

IDENTITIES
Deployment Identity : SCS.application, Version=3.4.0.9, Culture=neutral, PublicKeyToken=cc0fb6e85ade2b56, 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 \\asc-server\public\Programs\Installs\SCS\SCS.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
There were no warnings during this operation.

OPERATION PROGRESS STATUS
* [6/18/2014 8:19:42 AM] : Activation of \\asc-server\public\Programs\Installs\SCS\SCS.application has started.
* [6/18/2014 8:19:42 AM] : Processing of deployment manifest has successfully completed.
* [6/18/2014 8:19:42 AM] : Installation of the application has started.

ERROR DETAILS
Following errors were detected during this operation.
* [6/18/2014 8:19:42 AM] 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.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, 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)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.

我看到它说“Specified Cast is not Valid”,但我不太确定为什么会出现该错误。到目前为止,我已经尝试了以下方法(没有运气):

  1. 将 objective-c PU 从 x86 更改为任何 CPU
  2. 将签名从 sha1RSA 更改为 sha256RSA
  3. 以管理员身份运行 setup.exe
  4. 关闭所有 UAC
  5. 创建了一个基本的 Windows 窗体(1 个窗体,1 个按钮)并尝试安装,但出现同样的错误。
  6. 最新 - 我从基本的 Windows 窗体应用程序中获取了 .exe,并在 Surface Pro 上运行它,它运行良好,所以我认为这一定是设置问题。<

在这一点上,我认为这是我缺少的 Surface Pro 或 VS 部署设置的设置。

非常感谢任何想法或建议!

最佳答案

这是由于用户安全设置引起的。

security settings

如果您选择它,如图所示,问题会自动解决。您可以继续安装。

如果您看不到上面链接中的图片;

打开控制面板 -> 用户帐户控制设置

调整从顶部数第二个 slider 。 (仅当应用程序尝试更改我的计算机时通知我(默认)

关于c# - ClickOnce 无法运行 - 获取 'Specified Cast Not Valid',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24287717/

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