Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Intermittent Access denied on restart after ClickOnce update
 

Intermittent Access denied on restart after ClickOnce update

I have a Windows Forms application that has a ClickOnce update check in Program.cs and an immediateAsyncUpdate / Application.Restart(). Periodically, the restarted application fails on startup with the following error:

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

at System.Deployment.Internal.Isolation.IActContext.SetApplicationRunningState(UInt32 dwFlags, UInt32 ulState, UInt32& ulDisposition)

at System.ActivationContext.SetApplicationState(ApplicationState s)

at System.AppDomain.SetupDomainForApplication(ActivationContext activationContext, String[] activationData)

at System.AppDomain.SetupApplicationHelper(Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, ApplicationIdentity appIdentity, ActivationContext activationContext, String[] activationData)

at System.AppDomain.SetDomainManager(Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, IntPtr parentSecurityDescriptor, Boolean publishAppDomain)

at System.AppDomain.SetDefaultDomainManager(String fullName, String[] manifestPaths, String[] activationData)

Subsequently starting the application from the start menu succeeds.

This problem seem to only occur on some machines and not on others even though these machines are similarily configured. We've tried delayed restarts, shutting down antivirus and clearing the clickonce cache with mage to no avail.

Thanks.

lliston  Wednesday, April 15, 2009 2:52 PM

Hi lliston,

From the call stack you provided, it seems the application is failed due to some permission problems. However, It's hard to tell which part is exactly the cause since I know little about your project.

I just find a case with similar context as yours and the same exception, you can take a look at, and see if you can gain the clues.

If the problem can't be solved, would you please let me know more about your application?

Best regards,

Bruce Zhou


Please mark the replies as answers if they help and unmark if they don't.
Bruce.Zhou  Friday, April 17, 2009 1:39 AM
Thanks for the reply. It appears no one wants to touch this one - understandably so.

Interesting thing, we created a simple windows forms program that sleeps for 10 seconds then calls CheckForUpdate(), Update() and then Application.Restart() as appropriate. We then published several times. The issue would consistently happen on the same machines and did not occur on the others. On the machines itdid occur on, it wasinconsistent as to the number of installs before it would fail (usually 5-10).From this it appears to have more to do with the machine being installed on than the application or server.

Another interesting observation is that the target machines are all Windows XP Pro with imaged drives and SMS pushed updates.
This is a difficult one to find since the error is happening before the application's main() is called in Program.cs so we have no means to attach a debugger.

Thanks again.
lliston  Friday, April 17, 2009 6:57 PM
Hi lliston,

As I guessed, the problem might be caused the user has not enough permission. Here's a blog containing a workaround for the exact error code.

Would you please try and let me know if it can help you solve the problem?


Best regards,
Bruce Zhou

Please mark the replies as answers if they help and unmark if they don't.
Bruce.Zhou  Saturday, April 18, 2009 4:28 AM
Hi lliston,

How's the problem now? Did you try the workaround mentioned in the blog I provided?


Best regards,
Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't.
Bruce.Zhou  Monday, April 20, 2009 2:21 AM

Sorry for the delayed response.

We have tried running mage -cc on the target machine. This had no effect. Also, to be clear about the issue, it occurs sporatically. Even when it fails, the application upgrades correctly - only the restart appears to fail. The error is happening after the restart in the startup of the second process but before Main() is called. After a failure, subsequent upgrades may (or may not) work correctly.

Thanks again

lliston  Tuesday, April 21, 2009 7:28 PM
Hi lliston,

Recently, I also made an small application. In my application, it will create an text file according to user's choice. As well, there are some code will try to access these file. All that works well. When some users have an update to application, it can't start anymore. Later I found that, after update the text file is not there. However, some users may not be influenced if they are not choosing to create the text file when they use the application.

I describe my experience here since I think the problem you are facing now is possible like mine. Please make sure some resources can be available after an update. As you said, the machines are similarly configured. We can't focus all of our attentions to the extra enviroment, but also need to review our application again.


Best regards,
Bruce zhou



Please mark the replies as answers if they help and unmark if they don't.
Bruce.Zhou  Wednesday, April 22, 2009 12:26 PM

You can use google to search for other answers

Custom Search

More Threads

• Chained MSI not working
• ClickOnce Specific path for intallation in target machine
• how to read installation/publich path on run time
• Problem running clickonce app in vista
• Prompting a Reboot on a fresh installer and on update only if a perticular file is changed
• Win32 console app call to GetCommTimeouts fails when deployed
• Publishing application to location with an "&" / Ampersand causes "Value does not fall within the expected range." exception.
• Outlook Add-in : Unable to build assembly
• ClickOnce with programmatic updates only
• Sneaky Way to get an EULA displayed for your clickonce application in VS2005