C# ClickOnce 应用程序错误:部署和应用程序没有匹配的安全区域
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9227105/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ClickOnce Application Error: Deployment and application do not have matching security zones
提问by Bindas
I am having trouble on ClickOnce Application with FireFox and Chrome in IE it works fine. the Detail Of exception is:
我在使用 IE 中的 FireFox 和 Chrome 的 ClickOnce 应用程序上遇到问题,它工作正常。异常的详细信息是:
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.
Please Help Me out on this problem.
请帮我解决这个问题。
回答by RobinDotNet
If you're getting the error above, then it doesn't think you're signing the manifests. Be sure in the Signing tab that you have the checkbox checked, and a valid certificate selected. Also, are you publishing this in Full Trust or partial trust? If doing Partial Trust, change it to Full Trust, especially if doing internet install.
如果您收到上述错误,则认为您没有签署清单。确保在签名选项卡中选中了复选框,并选择了有效的证书。另外,您是在完全信任还是部分信任中发布此内容?如果进行部分信任,请将其更改为完全信任,尤其是在进行 Internet 安装时。
回答by Michael
Downloading file breaks relative link
下载文件断开相对链接
The problem is that the error message should have been ExampleAppName.exe.manifest could not be found.
问题是错误消息应该是ExampleAppName.exe.manifest could not be found.
If you open the ExampleAppName.applicationfile that was downloaded you can see it probably points to a path like Application Files\ExampleAppName.exe.manifestand that file does not exist locally.
如果您打开ExampleAppName.application下载的文件,您可以看到它可能指向一个类似的路径,Application Files\ExampleAppName.exe.manifest并且该文件在本地不存在。
It still works in IE because IE starts the installer WITHOUT downloading the file. Then the manifest file does in fact exist in a relative path to where the ExampleAppName.applicationfile is on the Internet.
它在 IE 中仍然有效,因为 IE 无需下载文件即可启动安装程序。那么清单文件实际上确实存在于该ExampleAppName.application文件在 Internet 上的位置的相对路径中。
Manually convert into absolute link
手动转换为绝对链接
The fix is to change the ExampleAppName.applicationfile and provide it an absolute path to where the AppName.exe.manifestexists on the Internet.
修复方法是更改ExampleAppName.application文件并为其提供AppName.exe.manifestInternet 上存在位置的绝对路径。
回答by Bear
Configure Visual Studio to include update location
配置 Visual Studio 以包含更新位置
This works for VS2008 projects at least:
这至少适用于 VS2008 项目:
Properties -> Publish -> Updates -> Set the update location to http://www.example.com/ApplicationName/
属性 -> 发布 -> 更新 -> 将更新位置设置为 http://www.example.com/ApplicationName/
This will add a <deploymentProvider codebase=... />subsection to the <deployment>section in your .applicationfile. And this (at least) Chrome accepts.
这将向文件中<deploymentProvider codebase=... />的<deployment>部分添加一个小节.application。这(至少)Chrome 接受。
回答by Dumisani
You need to install the ClickOnce Extension for Chrome and enable it. Your application will run instantly without you clicking on the downloaded app.
您需要为 Chrome 安装 ClickOnce 扩展并启用它。您的应用程序将立即运行,无需您点击下载的应用程序。
回答by ScottN
In Visual Studio 2013 I've verified that this error is caused by having the "Exclude deployment provider URL" checked in the Publish options of the project.
在 Visual Studio 2013 中,我已验证此错误是由在项目的发布选项中选中“排除部署提供程序 URL”引起的。
Project Properties > Publish > Options > Manifests > Un-tick "Exclude deployment provider URL"
As a extra precaution, make sure to provide your root URL where the application updates/install will live:
作为额外的预防措施,请确保提供应用程序更新/安装所在的根 URL:
Project Properties > Publish > Updates > Update Location (Provide the root URL where this application will be found)

