【发布时间】:2011-08-16 17:31:32
【问题描述】:
当我尝试为 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)
我见过fewsolutions,但他们都告诉我解决方案是在IIS 上更改MIME 类型。 托管文件的服务器上未安装 IIS。
除了“更改 MIME 类型”之外,还有什么办法可以解决这个问题?
更新
请参阅this thread 中的第二篇文章,了解我运行的一些测试用例。总结是:setup.exe 文件似乎使用工作目录来下载其文件,因为当我通过网络运行 EXE 文件时它工作正常,但是如果我将 EXE 复制到本地磁盘则会失败。
除了“告诉人们只从网络路径运行它”之外,我该如何解决这个问题?
更新2:
用十六进制编辑器查看setup.exe 文件,我在其中的任何地方都找不到我的安装路径。当我将安装路径更改为http://example.com/Test 时,我很容易找到它。
如果您使用UNC 路径,它不会保存发布位置/安装路径是 Visual Studio 的错误吗?
【问题讨论】: