intermittent failure with clickonce deployment (0x8007001F)

1

I am deploying an WPF application in business environment (AD) using clickonce deployment. The application is develop with Visual Studio 2013 and based on .Net 4.5. The deployment targets Windows 7 machines only. The deployment Server uses IIS 7.5 and runs on Windows Server 2008 R2.

The deployment is configured that the applications checks for updates before the applications starts.

The deployment works at least the most of the time but I recently experiencing random issues on a few machines while installing an application update.

The user receives the following error message:

Application cannot be started. Contact the application publisher.

Cannot start the application. Contact the application vendor for assistance.

this error is document in MSDN, Troubleshooting Specific Errors in ClickOnce Deployments

These are generic error messages that occur when the application cannot be started, and no other specific reason can be found.

I managed to gather a log file which covers this error:

PLATFORM VERSION INFO
Windows                       : 6.1.7601.65536 (Win32NT)
Common Language Runtime       : 4.0.30319.18444
System.Deployment.dll         : 4.0.30319.18408 built by: FX451RTMGREL
clr.dll                       : 4.0.30319.18444 built by: FX451RTMGDR
dfdll.dll                     : 4.0.30319.18408 built by: FX451RTMGREL
dfshim.dll                    : 4.0.41209.0 (Main.041209-0000)

SOURCES
    Deployment url: file:///C:/Users/ADUSERNAME/AppData/Roaming/Microsoft/Windows/Start%20Menu/Programs/Supply%20Chain%20Services%20-%20Systems%20and%20Processes/APPLICATIONNAME/APPLICATIONNAME%20Suite.appref-ms%7C
    Server: Microsoft-IIS/7.5
    X-Powered-By: ASP.NET
    Deployment Provider url: http://SERVERNAME:PORT/APPLICATIONNAME.application
    Application url: http://SERVERNAME:PORT/Application%20Files/APPLICATIONNAME_1_0_3_9/APPLICATIONNAME.exe.manifest
    Server: Microsoft-IIS/7.5
    X-Powered-By: ASP.NET

IDENTITIES
    Application Identity: APPLICATIONNAME.exe, Version=1.0.3.9, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXX, processorArchitecture=msil, type=win32

ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of C:\Users\ADUSERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Supply Chain Services - Systems and Processes\APPLICATIONNAME\APPLICATIONNAME Suite.appref-ms| resulted in exception. Following failure messages were detected:
                    + A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F)

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    * [08/09/2014 09:25:02] : Activation of C:\Users\ADUSERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Supply Chain Services - Systems and Processes\APPLICATIONNAME\APPLICATIONNAME Suite.appref-ms| has started.
    * [08/09/2014 09:25:04] : Performing necessary update check as specified by the deployment.
    * [08/09/2014 09:25:07] : Consuming new update.
    * [08/09/2014 09:25:09] : Installation of the application has started.
    * [08/09/2014 09:25:10] : Processing of application manifest has successfully completed.
    * [08/09/2014 09:25:10] : Found compatible runtime version 4.0.30319.
    * [08/09/2014 09:25:10] : Request of trust and detection of platform is complete.
    * [08/09/2014 09:25:18] : Downloading of subscription dependencies is complete.
    * [08/09/2014 09:25:18] : Commit of the downloaded application has started.

ERROR DETAILS
    Following errors were detected during this operation.
    * [08/09/2014 09:25:22] System.Runtime.InteropServices.COMException
                    - A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F)
                    - Source: System.Deployment
                    - Stack trace:
                                    at System.Deployment.Internal.Isolation.IStore.Transact(IntPtr cOperation, StoreTransactionOperation[] rgOperations, UInt32[] rgDispositions, Int32[] rgResults)
                                    at System.Deployment.Application.ComponentStore.SubmitStoreTransaction(StoreTransactionContext storeTxn, SubscriptionState subState)
                                    at System.Deployment.Application.ComponentStore.CommitApplication(SubscriptionState subState, CommitApplicationParams commitParams)
                                    at System.Deployment.Application.SubscriptionStore.CommitApplication(SubscriptionState& subState, CommitApplicationParams commitParams)
                                    at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
                                    at System.Deployment.Application.ApplicationActivator.ConsumeUpdatedDeployment(SubscriptionState& subState, ActivationDescription actDesc)
                                    at System.Deployment.Application.ApplicationActivator.PerformDeploymentUpdate(SubscriptionState& subState, String& errorPageUrl)
                                    at System.Deployment.Application.ApplicationActivator.ProcessOrFollowShortcut(String shortcutFile, String& errorPageUrl, TempFile& deployFile)
                                    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)

COMPONENT STORE TRANSACTION DETAILS
    * Transaction at [08/09/2014 09:25:22]
                    + System.Deployment.Internal.Isolation.StoreOperationStageComponent
                                    - Status: Installed
                                    - HRESULT: 0x0
                                    - Manifest: ZJHPL38T.V57.application
                    + System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata
                                    - Status: Set
                                    - HRESULT: 0x0
                    + System.Deployment.Internal.Isolation.StoreOperationStageComponent
                                    - Status: Installed
                                    - HRESULT: 0x0
                                    - Manifest: APPLICATIONNAME.exe.manifest
                    + System.Deployment.Internal.Isolation.StoreOperationStageComponentFile
                                    - Status: Installed
                                    - HRESULT: 0x0
                                    - File: APPLICATIONNAME.exe.config
                    !!! Removed 550 Lines !!!
                    + System.Deployment.Internal.Isolation.StoreOperationInstallDeployment
                                    - Status: Installed
                                    - HRESULT: 0x0
                                    - AppId: http://SERVERNAME:PORT/APPLICATIONNAME.application#APPLICATIONNAME.application, Version=1.0.3.9, Culture=neutral, PublicKeyToken=e5b020d18338a5ca, processorArchitecture=msil
                    + System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata
                                    - Status: Set
                                    - HRESULT: 0x0
                    + System.Deployment.Internal.Isolation.StoreOperationUninstallDeployment
                                    - Status: Uninstalled
                                    - HRESULT: 0x0
                                    - AppId: http://SERVERNAME:PORT/APPLICATIONNAME.application#APPLICATIONNAME.application, Version=1.0.3.3, Culture=neutral, PublicKeyToken=e5b020d18338a5ca, processorArchitecture=msil
                    + System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata
                                    - Status: Set
                                    - HRESULT: 0x0
                    + System.Deployment.Internal.Isolation.StoreTransactionOperationType (27)
                                    - HRESULT: 0x8007001f

I also activated detailed logging (using this guide) for my test machine but I was not able to reproduce this error or recognize a pattern which causes the error.

The error affects only 5% to 10% percent of the users, uninstall & reinstall is a workaround but not a solution.


In Reply to Hans Passant:

The | is indeed a strange character, I have neither clue where it comes from nor what it stands for in this context. However the deployment url (including the | symbol) is always the same and it works in 90% of the cases. I don’t think that the | symbol is the cause of the problem. However, I will try to find out why the character is there and come back to you afterwards.

Uninstall/Reinstall solves the problem on client side (Same installer!). Therefore we can exclude a corrupted .Net/VS install.

Anti-malware (McAfee) could be a problem I will investigate as soon I manage to reproduce the error on one of my test machines.

The file path is 123 characters long; the file name has 21 characters. File path + file name = 144 characters

wpf
deployment
visual-studio-2013
clickonce
asked on Stack Overflow Sep 15, 2014 by Joel • edited Sep 23, 2014 by Joel

2 Answers

2
 ...\APPLICATIONNAME\APPLICATIONNAME Suite.appref-ms|

The .NET Framework normally screams bloody murder when it gets a filename like that. The System.IO.Path.CheckInvalidPathChars() method will throw a "Illegal characters in path" exception, the | character is not valid in a file or directory name. But that check isn't performed in the ClickOnce plumbing, it doesn't use the normal file handling code like the FileStream and Path classes.

That bad filename goes straight to the operating system. What happens next is fairly unguessable, but the file system flipping the bird on it like that is certainly not unexpected.

I have no reasonable guess how this got mangled, this just never goes wrong. A wild guess is that you have one machine around that has a corrupted file in the .NET Framework or VS install, given the frequency of this problem. Might be on the desktop of a particular dev. If the same installer produces a good install when it is run again then the problem is client side. Anti-malware is always suspect. The name is long, you could be a bit beyond MAX_PATH (259 chars) and tripping a buffer overflow bug.

Just wild guesses. But that's the problem. Good luck hunting it down.

answered on Stack Overflow Sep 19, 2014 by Hans Passant • edited Sep 20, 2014 by Hans Passant
1

This is often happen to my click once deployment when the apps is updating or installing

What i did was run the following

rundll32 %windir%\system32\dfshim.dll CleanOnlineAppCache

to clear the wpf cache and run the url again to install

you can give the user a bat file with the command and ask them to run it when they encountered problem installing/updating

answered on Stack Overflow Sep 24, 2014 by Amin Budianto • edited Sep 24, 2014 by Amin Budianto

User contributions licensed under CC BY-SA 3.0