ClickOnce应用程序错误:部署和应用程序没有匹配的安全区域

时间:2012-02-10 11:31:36

标签: c# asp.net winforms clickonce

我在使用FireFox的ClickOnce应用程序和IE浏览器中遇到问题它运行正常。 例外的细节是:

PLATFORM VERSION INFO
    Windows             : 6.1.7600.0 (Win32NT)
    Common Language Runtime     : 4.0.30319.239
    System.Deployment.dll       : 4.0.30319.1 (RTMRel.030319-0100)
    clr.dll             : 4.0.30319.239 (RTMGDR.030319-2300)
    dfdll.dll           : 4.0.30319.1 (RTMRel.030319-0100)
    dfshim.dll          : 4.0.31106.0 (Main.031106-0000)

SOURCES
    Deployment url          : file:///C:/Users/ibz/Downloads/MyApp.application

IDENTITIES
    Deployment Identity     : MyApp.application, Version=1.0.1.23, Culture=neutral, PublicKeyToken=0000000000000000, processorArchitecture=msil

APPLICATION SUMMARY
    * Online only application.
    * Trust url parameter is set.
ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of C:\Users\ibz\Downloads\MyApp.application resulted in exception. Following failure messages were detected:
        + Deployment and application do not have matching security zones.

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.

OPERATION PROGRESS STATUS
    * [2/10/2012 4:53:18 PM] : Activation of C:\Users\ibz\Downloads\MyApp.application has started.
    * [2/10/2012 4:53:18 PM] : Processing of deployment manifest has successfully completed.
    * [2/10/2012 4:53:18 PM] : Installation of the application has started.

ERROR DETAILS
    Following errors were detected during this operation.
    * [2/10/2012 4:53:18 PM] System.Deployment.Application.InvalidDeploymentException (Zone)
        - Deployment and application do not have matching security zones.
        - Source: System.Deployment
        - Stack trace:
            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)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.

请帮我解决这个问题。

7 个答案:

答案 0 :(得分:1)

如果您收到上述错误,那么它不会认为您正在签署清单。请确保在“签名”选项卡中选中了复选框,并选择了有效的证书。另外,您是以完全信任还是部分信任方式发布此内容?如果进行部分信任,请将其更改为完全信任,尤其是在进行互联网安装时。

答案 1 :(得分:1)

正在下载文件中断相对链接

问题是错误消息应该是ExampleAppName.exe.manifest could not be found

如果您打开已下载的ExampleAppName.application文件,您可以看到它可能指向Application Files\ExampleAppName.exe.manifest这样的路径,并且该文件在本地不存在。

它仍可在IE中运行,因为IE启动安装程序而不下载文件。然后清单文件确实存在于ExampleAppName.application文件在Internet上的相对路径中。

手动转换为绝对链接

修复方法是更改​​ExampleAppName.application文件,并为其提供Internet上AppName.exe.manifest所在位置的绝对路径。

答案 2 :(得分:1)

配置Visual Studio以包含更新位置

至少适用于VS2008项目:

属性 - >发布 - >更新 - >将更新位置设置为http://www.example.com/ApplicationName/

这会在<deployment>文件的.application部分添加<deploymentProvider codebase=... />子部分。这个(至少)Chrome接受了。

答案 3 :(得分:0)

您需要安装适用于Chrome的ClickOnce Extension并启用它。 您的应用程序将立即运行,而无需您单击下载的应用程序。

答案 4 :(得分:0)

在Visual Studio 2013中,我已验证此错误是由项目的“发布”选项中选中“排除部署提供程序URL”引起的。

Project Properties > Publish > Options > Manifests > Un-tick "Exclude deployment provider URL"

作为额外的预防措施,请确保提供应用程序更新/安装所在的根URL:

Project Properties > Publish > Updates > Update Location (Provide the root URL where this application will be found)

答案 5 :(得分:0)

以上解决方案都不适合我。

点击自动设置时间和同步时间为我修复它。

我这样做的原因是因为它在我的 PC 中是 2/8/2021,在我客户的 PC 中是 8/2/2021。所以我认为这可能以某种方式相关,它确实解决了问题。

答案 6 :(得分:0)

我通过在 app.manifest 文件中注释掉 application 标签的内容解决了这个问题。


    <application>
      <!-- A list of all Windows versions that this application is designed to work with. 
      Windows will automatically select the most compatible environment.-->

      <!-- If your application is designed to work with Windows Vista, uncomment the following supportedOS node-->
      <!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>-->

      <!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
      <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->

      <!-- If your application is designed to work with Windows 8, uncomment the following supportedOS node-->
      <!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>-->

      <!--The ID below indicates application support for Windows 8.1 -->
      <!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>-->
      
      <!--The ID below indicates application support for Windows 10 -->
      <!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>-->

    </application>

注意:如果 clickonce 被签名,那么只删除 vista 一个就行了,否则删除整个部分。您也可以首先尝试对 clickonce 进行签名。 希望这会有所帮助!!!