.net ClickOnce setup.exe 失败,但在使用 Windows 共享进行部署时 .application 文件工作正常
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7082410/
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 setup.exe fails, but the .application file works fine when using a Windows share for deployment
提问by Scott Chamberlain
I am getting the error of System.Deployment.Application.DeploymentDownloadExceptionwhen I try to run setup.exe for my ClickOnce application. If run it over the network from its original location it works fine, but if I copy setup.exefrom the path on the server I get the error
System.Deployment.Application.DeploymentDownloadException当我尝试为 ClickOnce 应用程序运行 setup.exe 时出现错误。如果从原始位置通过网络运行它,它工作正常,但如果我setup.exe从服务器上的路径复制,我会收到错误
Can not download application. The Application is missing required files.
无法下载应用程序。应用程序缺少必需的文件。
I need the setup as it installs some prerequisites (.NET4) that the end user may not have.
我需要设置,因为它安装了一些最终用户可能没有的先决条件 ( .NET4)。
Clicking the details button from the error window gives the following information:
单击错误窗口中的详细信息按钮会提供以下信息:
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.
The root of the problem is it is trying to download its files from the same path as setup.exeis run from (file:///C:/Users/srchamberlain/Downloadsin this case) instead of the actual deployment URL(\\fs1\contractflowtool)
问题的根源在于它试图从与setup.exe运行相同的路径(file:///C:/Users/srchamberlain/Downloads在这种情况下)而不是实际的部署URL( \\fs1\contractflowtool)
I have seen a fewsolutions, but all of them tell me the solution is to change the MIMEtype on IIS. IIS is not installed on the server that is hosting the files.
我看过一些解决方案,但他们都告诉我解决方案是更改IIS 上的MIME类型。IIS 未安装在托管文件的服务器上。
What else can be done to fix this besides "change the MIME types"?
除了“更改 MIME 类型”之外,还有什么可以解决此问题?
UPDATE
更新
See the second post in this threadfor some test cases I ran. The summary is: it appears that the setup.exefile uses the working directory to download its files as it works fine when I run the EXE file over the network, however it fails if I copy the EXE to my local disk.
有关我运行的一些测试用例,请参阅此线程中的第二篇文章。总结是:该setup.exe文件似乎使用工作目录下载其文件,因为当我通过网络运行 EXE 文件时它工作正常,但是如果我将 EXE 复制到我的本地磁盘,它会失败。
How do I resolve this issue other than "Tell people to just run it from the network path"?
除了“告诉人们只从网络路径运行它”之外,我该如何解决这个问题?
UPDATE2:
Looking at the setup.exefile with a hex editor, I could not find my install path anywhere in it. When I changed the install path to http://example.com/TestI was able to find it easily.
UPDATE2:setup.exe使用十六进制编辑器查看该文件,我在其中的任何地方都找不到我的安装路径。当我将安装路径更改为http://example.com/Test 时,我可以轻松找到它。
Is it a Visual Studio bug that it does not save the publishing location/install path if you are using a UNCpath?
如果您使用的是UNC路径,它是否是一个 Visual Studio 错误,它不会保存发布位置/安装路径?
回答by AndyD273
The way I understand it, the Setup.exefile doesn't contain your application; it's just how Visual Studio installs prerequisites, and then it runs your .applicationfile to actually install your application.
根据我的理解,该Setup.exe文件不包含您的应用程序;这就是 Visual Studio 安装先决条件,然后运行您的.application文件以实际安装您的应用程序的方式。
I tested this out with one of my own applications. First, I copied just setup.exeover and got the same error you did:
我用我自己的应用程序之一对此进行了测试。首先,我刚刚复制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'.
Then I copied the Video Uploader.applicationover to my desktop too and it worked. So it seems like if you want to install it from somewhere other than the network share, you just need to make sure that it has both files.
然后我也将其复制Video Uploader.application到我的桌面上并且它起作用了。所以看起来如果你想从网络共享以外的地方安装它,你只需要确保它有这两个文件。
Other things to check, if you don't have it downloading the prereqs from the venders website, then make sure that it is pointing to a static place, or at least make sure that you copy those files over too.
要检查的其他事项,如果您没有从供应商网站下载先决条件,请确保它指向静态位置,或者至少确保您也复制这些文件。
In the Publish Wizard, on the How will users install the application?page, I selected From a CD-ROM or DVD-Rom. I don't know if selecting either of the other two options might change how it works.
在发布向导的How will users install the application?页面上,I selected From a CD-ROM or DVD-Rom. 我不知道选择其他两个选项中的任何一个是否会改变它的工作方式。
Edit:
I read through your other post. I suspect that it has to do with how the different protocols handle files. I was able to get it working from the publish.htmlpage, but I actually published it to a webserver, so that the page address was http://www.example.com/programs/publish.html.
编辑:
我通读了你的另一篇文章。我怀疑这与不同协议处理文件的方式有关。我能够从publish.html页面上运行它,但我实际上将它发布到了网络服务器,因此页面地址是http://www.example.com/programs/publish.html.
I tried running it from n:\webroot\programs\publish.html, and it failed.
我尝试从 运行它n:\webroot\programs\publish.html,但失败了。
Do you have a way to publish it to a webserver? Or at least install IISor Apacheto make it into a webserver?
你有办法将它发布到网络服务器吗?或者至少安装IIS或Apache以使其成为网络服务器?
Alternately, just make sure that everyone has the prerequisites, and then have them click the launchlink:
或者,只需确保每个人都具备先决条件,然后让他们单击启动链接:


Edit 2:
编辑2:
Here is my publishing setup. It works by clicking on the install button in Internet Explorer, Firefox, and Chrome (all I tested).
这是我的发布设置。它通过单击 Internet Explorer、Firefox 和 Chrome(我测试过的所有内容)中的安装按钮来工作。




It seems like the setup file is looking at the website for the .applicationfile, so that it doesn't need to be on the local computer.
似乎安装文件正在查看该.application文件的网站,因此它不需要位于本地计算机上。
Edit 3:
编辑3:
In Windows (XP and Windows 7 verified):
* Step 1 : Start menu –> Run
* Step 2 : Type ‘iexpress' without ‘
* Step 3 : Follow the wizzard.
在 Windows 中(XP 和 Windows 7 已验证):
* 步骤 1:开始菜单 –> 运行
* 步骤 2:键入 'iexpress' 不带 '
* 步骤 3:按照向导操作。
http://expertester.wordpress.com/2008/07/11/create-self-extractinginstaller-for-free/
http://expertester.wordpress.com/2008/07/11/create-self-extractinginstaller-for-free/


Once it's done, then you can just make your own HTMLpage pointing to your installer EXE file. The only thing I ran into was that the install didn't work the first time every time. I ran it, and it didn't extract the files. Then I instantly ran it a second time, and it worked just fine... I don't know why yet.
完成后,您就可以制作自己的HTML页面,指向您的安装程序 EXE 文件。我遇到的唯一问题是每次第一次安装都不起作用。我运行了它,它没有提取文件。然后我立即第二次运行它,它工作得很好......我还不知道为什么。
回答by Mahen
We use a self-extracting ZIPfile to launch our installation. (There are many ways to do this, for example, use 7-Zip, WinZip, etc.) This way there is only 1 file to download.
我们使用自解压ZIP文件来启动我们的安装。(有很多方法可以做到这一点,例如,使用7-Zip、WinZip等)这种方式只需要下载 1 个文件。
But I'm not sure how you would handle updates in this scenario - I assume you could publish both the ClickOnce and the self extacting ZIP file so that the application finds the necessary files afterwards...
但我不确定在这种情况下您将如何处理更新 - 我假设您可以同时发布 ClickOnce 和自解压 ZIP 文件,以便应用程序之后找到必要的文件......
I hope this helps.
我希望这有帮助。

