ClickOnce setup.exe失败,但使用Windows共享进行部署时.application文件正常工作

时间:2011-08-16 17:31:33

标签: .net .net-4.0 clickonce

当我尝试为ClickOnce应用程序运行setup.exe时,我收到错误System.Deployment.Application.DeploymentDownloadException。如果通过网络从原始位置运行它可以正常工作,但是如果我从服务器上的路径复制setup.exe我就会收到错误

  

无法下载应用程序。应用程序缺少必需的文件。

我需要设置,因为它会安装最终用户可能没有的一些先决条件(.NET 4)。

单击错误窗口中的详细信息按钮将提供以下信息:

PLATFORM VERSION INFO
    Windows             : 6.1.7601.65536 (Win32NT)
    Common Language Runtime     : 4.0.30319.237
    System.Deployment.dll       : 4.0.30319.1 (RTMRel.030319-0100)
    clr.dll             : 4.0.30319.237 (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/srchamberlain/Downloads/ContractFlowTool.application

ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of C:\Users\srchamberlain\Downloads\ContractFlowTool.application resulted in exception. Following failure messages were detected:
        + Downloading file:///C:/Users/srchamberlain/Downloads/ContractFlowTool.application did not succeed.
        + Could not find file 'C:\Users\srchamberlain\Downloads\ContractFlowTool.application'.
        + Could not find file 'C:\Users\srchamberlain\Downloads\ContractFlowTool.application'.
        + Could not find file 'C:\Users\srchamberlain\Downloads\ContractFlowTool.application'.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    * [8/16/2011 12:23:26 PM] : Activation of C:\Users\srchamberlain\Downloads\ContractFlowTool.application has started.

ERROR DETAILS
    Following errors were detected during this operation.
    * [8/16/2011 12:23:26 PM] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
        - Downloading file:///C:/Users/srchamberlain/Downloads/ContractFlowTool.application did not succeed.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
            at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
            at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
            at System.Deployment.Application.DownloadManager.DownloadManifestAsRawFile(Uri& sourceUri, String targetPath, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
            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)
        --- Inner Exception ---
        System.Net.WebException
        - Could not find file 'C:\Users\srchamberlain\Downloads\ContractFlowTool.application'.
        - Source: System
        - Stack trace:
            at System.Net.FileWebRequest.EndGetResponse(IAsyncResult asyncResult)
            at System.Net.FileWebRequest.GetResponse()
            at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
        --- Inner Exception ---
        System.Net.WebException
        - Could not find file 'C:\Users\srchamberlain\Downloads\ContractFlowTool.application'.
        - Source: System
        - Stack trace:
            at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)
            at System.Net.FileWebRequest.GetResponseCallback(Object state)
        --- Inner Exception ---
        System.IO.FileNotFoundException
        - Could not find file 'C:\Users\srchamberlain\Downloads\ContractFlowTool.application'.
        - Source: mscorlib
        - Stack trace:
            at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
            at 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)
            at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
            at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
            at System.Net.FileWebStream..ctor(FileWebRequest request, String path, FileMode mode, FileAccess access, FileShare sharing, Int32 length, Boolean async)
            at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)

COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.

问题的根源在于它尝试从setup.exe运行的同一路径下载文件(在本例中为file:///C:/Users/srchamberlain/Downloads而不是实际部署URL\\fs1\contractflowtool

我见过few solutions,但所有这些都告诉我解决方法是更改​​IIS上的MIME类型。 在托管文件的服务器上未安装IIS。

除了"更改MIME类型"?

之外还可以做些什么来解决这个问题

更新

有关我运行的一些测试用例,请参阅this thread中的第二篇文章。摘要是:setup.exe文件似乎使用工作目录下载文件,因为它通过网络运行EXE文件时工作正常,但如果我将EXE复制到本地磁盘则失败。 / p>

如何解决此问题而不是"告诉人们只是从网络路径运行它"?


UPDATE2: 使用十六进制编辑器查看setup.exe文件,我无法在其中的任何位置找到我的安装路径。当我将安装路径更改为http://example.com/Test时,我能够轻松找到它。

如果您使用UNC路径,它是否会保存发布位置/安装路径,这是Visual Studio错误吗?

2 个答案:

答案 0 :(得分:26)

我理解它的方式,Setup.exe文件不包含您的应用程序;它只是Visual Studio如何安装先决条件,然后运行您的.application文件来实际安装您的应用程序。

我用自己的一个应用程序测试了这个。首先,我只复制了setup.exe并得到了同样的错误:

ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of C:\Users\Andy\Desktop\Video Uploader.application resulted in exception. Following failure messages were detected:
        + Downloading file:///C:/Users/Andy/Desktop/Video Uploader.application did not succeed.
        + Could not find file 'C:\Users\Andy\Desktop\Video Uploader.application'.
        + Could not find file 'C:\Users\Andy\Desktop\Video Uploader.application'.
        + Could not find file 'C:\Users\Andy\Desktop\Video Uploader.application'.

然后我将Video Uploader.application复制到我的桌面上并且它有效。所以看起来如果你想从网络共享以外的地方安装它,你只需要确保它有两个文件。

要检查的其他事项,如果您没有从供应商网站下载先决条件,请确保它指向静态位置,或者至少确保您复制这些文件。

在发布向导的How will users install the application?页面上,I selected From a CD-ROM or DVD-Rom。我不知道选择其他两个选项中的任何一个可能会改变它的工作方式。

修改
我读完了你的另一篇文章。我怀疑它与不同协议如何处理文件有关。我能够从publish.html页面开始工作,但实际上我已将其发布到网络服务器,因此页面地址为http://www.example.com/programs/publish.html

我尝试从n:\webroot\programs\publish.html运行它,但它失败了。

您有办法将其发布到网络服务器吗?或者至少安装IISApache以使其成为网络服务器?

或者,只需确保每个人都有先决条件,然后让他们点击启动链接:

Enter image description here

编辑2:

这是我的发布设置。它的工作原理是点击Internet Explorer,Firefox和Chrome中的安装按钮(我测试过的所有内容)。

Enter image description here

Enter image description here

似乎设置文件正在查看.application文件的网站,因此它不需要位于本地计算机上。

编辑3:

在Windows中(经过XP和Windows 7验证):
 *第1步:开始菜单 - >运行
 *第2步:输入'iexpress'而不是'
 *第3步:跟随wizzard。

http://expertester.wordpress.com/2008/07/11/create-self-extractinginstaller-for-free/

Enter image description here

完成后,您只需创建指向安装程序EXE文件的HTML页面即可。 我遇到的唯一一件事就是安装在每次第一次都没有工作。我运行它,它没有提取文件。然后我立即再次运行它,它工作得很好......我不知道为什么。

答案 1 :(得分:2)

我们使用自解压ZIP文件来启动我们的安装。 (有很多方法可以做到这一点,例如,使用7-ZipWinZip等。) 这样只需要下载1个文件。

但是我不确定你将如何处理这种情况下的更新 - 我假设您可以发布ClickOnce和自我提取的ZIP文件,以便应用程序在之后找到必要的文件...

我希望这会有所帮助。