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

时间:2015-01-27 13:59:24

标签: c# visual-studio-2012 clickonce

我收到错误" system.deployment.application.deploymentdownloadexception(未知子类型),无法下载应用程序。应用程序缺少必需的文件"在我的win c#apllication(visual studio 2012)中,当我尝试为我的clickonce应用程序运行setup.exe时。

在设置安装文件夹(共享文件夹)并在网络共享中发布(使用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?

提前致谢

1 个答案:

答案 0 :(得分:2)

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

首先,你可能没有使用IE浏览器。我只是设法用IE正常运行ClickOnce,其他浏览器都没有运行。

其次,您没有定义正确的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服务器。在本地,我通常只需运行.application文件来测试设置。