Click here to Skip to main content
15,909,645 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I am using shadow copy to update my dll when its in use.When service starts, dll runs from shadowcopied domain as result of which dll remains unlocked and can be updated also.It works well and fine in my machine.
But when we tried running the service on other machine ,service throws the following error:
"Specified user does not have valid profile ,Unable to load assmebly"

Cachepath is getting created .but problem is its unable to load from the cachepath .what would be the cause?
find below the code i have used:
C#
string _path="C:\\TTG\\Tools\\TtgUpdate\\"
 AppDomainSetup environment = new AppDomainSetup()
      {
         ApplicationBase = Path.GetDirectoryName(_path)
      };

       // instantiate the security policy for the application domain...
  Evidence evidence = AppDomain.CurrentDomain.Evidence;
       //Enable shadow copy option for the newly created domain for  the purpose to            
       // update TTGUpdateDLL when in use
AppDomain.CurrentDomain.SetShadowCopyFiles();
AppDomain.CurrentDomain.SetShadowCopyPath(Path.GetDirectoryName(_path));
environment.ShadowCopyDirectories = Path.GetDirectoryName(_path);
environment.ShadowCopyFiles = "true";
string _installPath = WindowsRegistry.Instance.Read(WindowsRegistry.REGKEYS.HKLM, "\\Software\\TTGTT\\System", "InstallDirectory");
environment.CachePath = _installPath + "\\Tools\\TtgUpdate\\AssemblyCatch";
environment.ApplicationName = "AppName";
string _shadowCopyPath = environment.CachePath + "\\" + environment.ApplicationName;
          
       // instantiate the application domain...
_appDomain = AppDomain.CreateDomain(friendlyName, evidence, environment);

Thanks in advance
Posted
Updated 9-Nov-11 17:24pm
v2

1 solution

Which credential your service uses? It might be requiring Administrator rights. Try to run it as Administrator.
 
Share this answer
 
v2
Comments
DepiyaReddy 9-Nov-11 23:36pm    
It runs as administrator

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900