Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
566 views
in Technique[技术] by (71.8m points)

.net - ClickOnce setup.exe fails, but the .application file works fine when using a Windows share for deployment

I am getting the error of System.Deployment.Application.DeploymentDownloadException when 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.exe from the path on the server I get the error

Can not download application. The Application is missing required files.

I need the setup as it installs some prerequisites (.NET 4) that the end user may not have.

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:UserssrchamberlainDownloadsContractFlowTool.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:UserssrchamberlainDownloadsContractFlowTool.application'.
        + Could not find file 'C:UserssrchamberlainDownloadsContractFlowTool.application'.
        + Could not find file 'C:UserssrchamberlainDownloadsContractFlowTool.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:UserssrchamberlainDownloadsContractFlowTool.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:UserssrchamberlainDownloadsContractFlowTool.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:UserssrchamberlainDownloadsContractFlowTool.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:UserssrchamberlainDownloadsContractFlowTool.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.exe is run from (file:///C:/Users/srchamberlain/Downloads in this case) instead of the actual deployment URL (\fs1contractflowtool)

I have seen a few solutions, but all of them tell me the solution is to change the MIME type on IIS. IIS is not installed on the server that is hosting the files.

What else can be done to fix this besides "change the MIME types"?


UPDATE

See the second post in this thread for some test cases I ran. The summary is: it appears that the setup.exe file 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.

How do I resolve this issue other than "Tell people to just run it from the network path"?


UPDATE2: Looking at the setup.exe file with a hex editor, I could not find my install path anywhere in it. When I changed the install path to http://example.com/Test I was able to find it easily.

Is it a Visual Studio bug that it does not save the publishing location/install path if you are using a UNC path?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The way I understand it, the Setup.exe file doesn't contain your application; it's just how Visual Studio installs prerequisites, and then it runs your .application file to actually install your application.

I tested this out with one of my own applications. First, I copied just setup.exe over and got the same error you did:

ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of C:UsersAndyDesktopVideo 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:UsersAndyDesktopVideo Uploader.application'.
        + Could not find file 'C:UsersAndyDesktopVideo Uploader.application'.
        + Could not find file 'C:UsersAndyDesktopVideo Uploader.application'.

Then I copied the Video Uploader.application over 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.

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.

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.html page, but I actually published it to a webserver, so that the page address was http://www.example.com/programs/publish.html.

I tried running it from n:webrootprogramspublish.html, and it failed.

Do you have a way to publish it to a webserver? Or at least install IIS or Apache to make it into a webserver?

Alternately, just make sure that everyone has the prerequisites, and then have them click the launch link:

Enter image description here

Edit 2:

Here is my publishing setup. It works by clicking on the install button in Internet Explorer, Firefox, and Chrome (all I tested).

Enter image description here

Enter image description here

It seems like the setup file is looking at the website for the .application file, so that it doesn't need to be on the local computer.

Edit 3:

In Windows (XP and Windows 7 verified):
* Step 1 : Start menu –> Run
* Step 2 : Type ‘iexpress’ without ‘
* Step 3 : Follow the wizzard.

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

Enter image description here

Once it's done, then you can just make your own HTML page 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...