尝试部署要下载的文件时,clickonce 安装失败

clickonce installation failed when trying to deploy files to be downloaded

我在我的 win c# 应用程序(visual studio 2012)中遇到 "system.deployment.application.deploymentdownloadexception (unknown subtype),Can not download application. The Application is missing required files" 错误,当我尝试 运行 setup.exe 我的 clickonce 应用程序时。

我在设置安装文件夹(共享文件夹)并在网络共享中发布它(使用 visualstudio 向导)后进行了 Clickonce 部署。

在 visual studio 我在我的网络文件夹中设置了安装文件夹 URL: \srv\Deploy\ 与 visual studio 向导中发布此应用程序以及用户安装应用程序的方式(从 UNC 路径或文件共享)相同的位置

在 visual studio 向导之后,会自动生成部署网页,我在其中单击安装按钮(下载 setup.exe)来安装我的应用程序。 setup.exe下载到C:\Users\Gio\Downloads 当我单击 setup.exe 时,会生成一个错误:

system.deployment.application.deploymentdownloadexception(未知亚型)

我尝试在默认网站中添加 mime 类型(.config、.manifestapplication),但同样出现错误

如果我 运行 从我的网络文件夹 \srv\Deploy\ 安装,安装工作正常。

详细错误是:

 PLATFORM VERSION INFO
Windows             : 6.1.7601.65536 (Win32NT)
Common Language Runtime     : 4.0.30319.18444
System.Deployment.dll       : 4.0.30319.34244 built by: FX452RTMGDR
clr.dll             : 4.0.30319.18444 built by: FX451RTMGDR
dfdll.dll           : 4.0.30319.34244 built by: FX452RTMGDR
dfshim.dll          : 4.0.31106.0 (Main.031106-0000)

SOURCES
URL distribuzione           : file:///C:/Users/Gio/Downloads/ClickOnce.application

ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later  in the log.
* Activation of  C:\Users\Gio\Downloads\ClickOnce.application ha causato un'eccezione. Sono stati rilevati i messaggi di errore seguenti:
    + Downloading file: file:///C:/Users/Gio/Downloads/ClickOnce.application.
    + Could not find file 'C:\Users\Gio\Downloads\ClickOnce.application'.
    + Could not find file 'C:\Users\Gio\Downloads\ClickOnce.application'.
    + Could not find file 'C:\Users\Gio\Downloads\ClickOnce.application'.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.

WARNINGS
There were no warnings during this operation.

OPERATION PROGRESS STATUS
* [27/01/2015 14:43:19] : Activation of C:\Users\Gio\Downloads\ClickOnce.application avviata.

ERROR DETAILS
Following errors were detected during this operation.
* [27/01/2015 14:43:19] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
    -  Downloading file file:///C:/Users/Gio/Downloads/ClickOnce.application.
    - Source: System.Deployment
    - Stack trace:
        in  System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
        in System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
        in System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
        in System.Deployment.Application.DownloadManager.DownloadManifestAsRawFile(Uri& sourceUri, String targetPath, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
        in System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
        in System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
        in System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
        in System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
    --- Inner Exception ---
    System.Net.WebException
    - Could not find file 'C:\Users\Gio\Downloads\ClickOnce.application'.
    - Source: System
    - Stack trace:
        in System.Net.FileWebRequest.EndGetResponse(IAsyncResult asyncResult)
        in System.Net.FileWebRequest.GetResponse()
        in System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
    --- Inner Exception ---
    System.Net.WebException
    - Could not find file 'C:\Users\Gio\Downloads\ClickOnce.application'.
    - Source: System
    - Stack trace:
        in System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)
        in System.Net.FileWebRequest.GetResponseCallback(Object state)
    --- Inner Exception ---
    System.IO.FileNotFoundException
    - Could not find file 'C:\Users\Gio\Downloads\ClickOnce.application'.
    - Source: mscorlib
    - Stack trace:
        in System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
        in System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
        in System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
        in System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
        in System.Net.FileWebStream..ctor(FileWebRequest request, String path, FileMode mode, FileAccess access, FileShare sharing, Int32 length, Boolean async)
        in System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)

COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.

我必须设置什么才能安装 setup.exe 单击网页中的安装按钮?

提前致谢

如果您的浏览器尝试下载 setup.exe 文件而不是开始安装,那么根据我的经验,有两个主要原因。

首先,您可能没有使用 IE。我只成功地 运行 使用 IE ClickOnce,none 其他浏览器工作。

其次,您没有定义正确的 MIME 类型。对于 Apache(可轻松移植到 IIS web.config),我在 .htaccess 文件中使用此配置:

AddType application/x-ms-application application
AddType application/x-ms-manifest manifest
AddType application/octet-stream deploy

这在 IE 上运行良好,但是,我从未尝试过在本地 Web 服务器上运行。在本地,我通常通过简单地 运行ning .application 文件来测试设置。