Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > ClickOnce Deployment Fails to Load Library after Impersonation
 

ClickOnce Deployment Fails to Load Library after Impersonation

I have an application that accesses a database that lives in a different Win2K3 domain. The application creates a windows Identity and authenticates the credentials and then does impersonation so that the database access happens in the context of this impersonated users credentials.

Everything works great except the impersonation breaks clickOnce deployment. I am not totally sure exactly where or why but the app deploys and starts up but after the impersonation it tries to load an assembly and fails because the impersonated user does not have the necessary permissions. The application is running with Full Trust so I am not sure why it fails. If I install the application on the machine the old fashion way it works fine and if I add the impersonated users to the local administrators group (Just a debugging hack! Not an acceptable solution!) then it works fine as well but under the preferred deployment scenario which is to launch it as a clickOnce App, collect the alternate credentials at startup and then impersonate that users it dies with the following error.

Could not load file or assembly 'AppControls, Version=1.1.2412.17609, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.

Unfortunately the remote resource access does not sort out nicely so the Impersonation is done globally (kind of an afterthought) so it would not be easy to only do impersonation when accessing the remote resources. Any ideas how to deal with this would be appreciated.

PugJ  Wednesday, August 09, 2006 8:54 PM
Did you ever figure this out?

I am trying to use ClickOnce from a test domain that checks on a published share on the corporate domain.
For impersonation I am using a cleaned up version of this code:

The impersonation code I wrote works as follows:
Impersonator imp = new Impersonator("corp", "user", "password");
bool foo = File.Exists(@"\\server\share\file.txt");
imp.Start();
foo =File.Exists(@"\\server\share\file.txt");
imp.Stop();
foo =File.Exists(@"\\server\share\file.txt");

I then try to use ApplicationDeployment and get an Access Denied:
if (ApplicationDeployment.IsNetworkDeployed)
{
ad = ApplicationDeployment.CurrentDeployment;
imp.Start();
info = ad.CheckForDetailedUpdate();
imp.Stop();
}

I tried adding the domain account to my local machine's Administrators group, but that didn't seem to make a diff.
I guess I could try to set up a trust relationship between my test domain and the corporate domain, but I was really hoping to just impersonate a generic role account and get ClickOnce to work that way. :(

Pv
paulpv  Saturday, September 19, 2009 4:08 AM

You can use google to search for other answers

Custom Search

More Threads

• MSI
• dfsvc crash on limited user
• General Deployment
• How to add a friendly name to a certificate
• Click Once appliction name change
• VS 2008 Install Project Unknown Error on one machine
• How to let setup.exe load components from its parent folder?
• How can you change the data source location in a ClickOnce deployment?
• Setup.exe Bootstrapper Configuration
• Automatic updates